id
int64 0
843k
| repository_name
stringlengths 7
55
| file_path
stringlengths 9
332
| class_name
stringlengths 3
290
| human_written_code
stringlengths 12
4.36M
| class_skeleton
stringlengths 19
2.2M
| total_program_units
int64 1
9.57k
| total_doc_str
int64 0
4.2k
| AvgCountLine
float64 0
7.89k
| AvgCountLineBlank
float64 0
300
| AvgCountLineCode
float64 0
7.89k
| AvgCountLineComment
float64 0
7.89k
| AvgCyclomatic
float64 0
130
| CommentToCodeRatio
float64 0
176
| CountClassBase
float64 0
48
| CountClassCoupled
float64 0
589
| CountClassCoupledModified
float64 0
581
| CountClassDerived
float64 0
5.37k
| CountDeclInstanceMethod
float64 0
4.2k
| CountDeclInstanceVariable
float64 0
299
| CountDeclMethod
float64 0
4.2k
| CountDeclMethodAll
float64 0
4.2k
| CountLine
float64 1
115k
| CountLineBlank
float64 0
9.01k
| CountLineCode
float64 0
94.4k
| CountLineCodeDecl
float64 0
46.1k
| CountLineCodeExe
float64 0
91.3k
| CountLineComment
float64 0
27k
| CountStmt
float64 1
93.2k
| CountStmtDecl
float64 0
46.1k
| CountStmtExe
float64 0
90.2k
| MaxCyclomatic
float64 0
759
| MaxInheritanceTree
float64 0
16
| MaxNesting
float64 0
34
| SumCyclomatic
float64 0
6k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
147,148 |
LordSputnik/mutagen
|
LordSputnik_mutagen/mutagen/id3.py
|
mutagen.id3.ID3
|
class ID3(DictProxy, mutagen.Metadata):
"""A file with an ID3v2 tag.
Attributes:
* version -- ID3 tag version as a tuple
* unknown_frames -- raw frame data of any unknown frames found
* size -- the total size of the ID3 tag, including the header
"""
PEDANTIC = True
version = (2, 4, 0)
filename = None
size = 0
__flags = 0
__readbytes = 0
__crc = None
__unknown_version = None
_V24 = (2, 4, 0)
_V23 = (2, 3, 0)
_V22 = (2, 2, 0)
_V11 = (1, 1)
def __init__(self, *args, **kwargs):
self.unknown_frames = []
super(ID3, self).__init__(*args, **kwargs)
def __fullread(self, size):
""" Read a certain number of bytes from the source file. """
try:
if size < 0:
raise ValueError('Requested bytes (%s) less than zero' % size)
if size > self.__filesize:
raise EOFError('Requested %#x of %#x (%s)' % (
int(size), int(self.__filesize), self.filename))
except AttributeError:
pass
data = self._fileobj.read(size)
if len(data) != size:
raise EOFError
self.__readbytes += size
return data
def load(self, filename, known_frames=None, translate=True, v2_version=4):
"""Load tags from a filename.
Keyword arguments:
* filename -- filename to load tag data from
* known_frames -- dict mapping frame IDs to Frame objects
* translate -- Update all tags to ID3v2.3/4 internally. If you
intend to save, this must be true or you have to
call update_to_v23() / update_to_v24() manually.
* v2_version -- if update_to_v23 or update_to_v24 get called (3 or 4)
Example of loading a custom frame::
my_frames = dict(mutagen.id3.Frames)
class XMYF(Frame): ...
my_frames["XMYF"] = XMYF
mutagen.id3.ID3(filename, known_frames=my_frames)
"""
if not v2_version in (3, 4):
raise ValueError("Only 3 and 4 possible for v2_version")
from os.path import getsize
self.filename = filename
self.__known_frames = known_frames
self._fileobj = open(filename, 'rb')
self.__filesize = getsize(filename)
try:
try:
self._load_header()
except EOFError:
self.size = 0
raise ID3NoHeaderError("%s: too small (%d bytes)" % (
filename, self.__filesize))
except (ID3NoHeaderError, ID3UnsupportedVersionError) as err:
self.size = 0
import sys
stack = sys.exc_info()[2]
try:
self._fileobj.seek(-128, 2)
except EnvironmentError:
reraise(err, None, stack)
else:
frames = ParseID3v1(self._fileobj.read(128))
if frames is not None:
self.version = self._V11
for v in frames.values():
self.add(v)
else:
reraise(err, None, stack)
else:
frames = self.__known_frames
if frames is None:
if self._V23 <= self.version:
frames = Frames
elif self._V22 <= self.version:
frames = Frames_2_2
data = self.__fullread(self.size - 10)
for frame in self.__read_frames(data, frames=frames):
if isinstance(frame, Frame):
self.add(frame)
else:
self.unknown_frames.append(frame)
self.__unknown_version = self.version
finally:
self._fileobj.close()
del self._fileobj
del self.__filesize
if translate:
if v2_version == 3:
self.update_to_v23()
else:
self.update_to_v24()
def getall(self, key):
"""Return all frames with a given name (the list may be empty).
This is best explained by examples::
id3.getall('TIT2') == [id3['TIT2']]
id3.getall('TTTT') == []
id3.getall('TXXX') == [TXXX(desc='woo', text='bar'),
TXXX(desc='baz', text='quuuux'), ...]
Since this is based on the frame's HashKey, which is
colon-separated, you can use it to do things like
``getall('COMM:MusicMatch')`` or ``getall('TXXX:QuodLibet:')``.
"""
if key in self:
return [self[key]]
else:
key = key + ':'
return [v for s, v in self.items() if s.startswith(key)]
def delall(self, key):
"""Delete all tags of a given kind; see getall."""
if key in self:
del(self[key])
else:
key = key + ":"
for k in self.keys():
if k.startswith(key):
del(self[k])
def setall(self, key, values):
"""Delete frames of the given type and add frames in 'values'."""
self.delall(key)
for tag in values:
self[tag.HashKey] = tag
def pprint(self):
"""Return tags in a human-readable format.
"Human-readable" is used loosely here. The format is intended
to mirror that used for Vorbis or APEv2 output, e.g.
``TIT2=My Title``
However, ID3 frames can have multiple keys:
``POPM=user@example.org=3 128/255``
"""
frames = sorted(Frame.pprint(s) for s in self.values())
return '\n'.join(frames)
def loaded_frame(self, tag):
"""Deprecated; use the add method."""
# turn 2.2 into 2.3/2.4 tags
if len(type(tag).__name__) == 3:
tag = type(tag).__base__(tag)
self[tag.HashKey] = tag
# add = loaded_frame (and vice versa) break applications that
# expect to be able to override loaded_frame (e.g. Quod Libet),
# as does making loaded_frame call add.
def add(self, frame):
"""Add a frame to the tag."""
return self.loaded_frame(frame)
def _load_header(self):
fn = self.filename
data = self.__fullread(10)
id3, vmaj, vrev, flags, size = unpack('>3sBBB4s', data)
self.__flags = flags
self.size = BitPaddedInt(size) + 10
self.version = (2, vmaj, vrev)
if id3 != b'ID3':
raise ID3NoHeaderError("%r doesn't start with an ID3 tag" % fn)
if vmaj not in [2, 3, 4]:
raise ID3UnsupportedVersionError("%r ID3v2.%d not supported"
% (fn, vmaj))
if self.PEDANTIC:
if not BitPaddedInt.has_valid_padding(size):
raise ValueError("Header size not synchsafe")
if (self._V24 <= self.version) and (flags & 0x0f):
raise ValueError("%r has invalid flags %#02x" % (fn, flags))
elif (self._V23 <= self.version < self._V24) and (flags & 0x1f):
raise ValueError("%r has invalid flags %#02x" % (fn, flags))
if self.f_extended:
extsize = self.__fullread(4)
if extsize.decode('ascii') in Frames:
# Some tagger sets the extended header flag but
# doesn't write an extended header; in this case, the
# ID3 data follows immediately. Since no extended
# header is going to be long enough to actually match
# a frame, and if it's *not* a frame we're going to be
# completely lost anyway, this seems to be the most
# correct check.
# http://code.google.com/p/quodlibet/issues/detail?id=126
self.__flags ^= 0x40
self.__extsize = 0
self._fileobj.seek(-4, 1)
self.__readbytes -= 4
elif self.version >= self._V24:
# "Where the 'Extended header size' is the size of the whole
# extended header, stored as a 32 bit synchsafe integer."
self.__extsize = BitPaddedInt(extsize) - 4
if self.PEDANTIC:
if not BitPaddedInt.has_valid_padding(extsize):
raise ValueError("Extended header size not synchsafe")
else:
# "Where the 'Extended header size', currently 6 or 10 bytes,
# excludes itself."
self.__extsize = unpack('>L', extsize)[0]
if self.__extsize:
self.__extdata = self.__fullread(self.__extsize)
else:
self.__extdata = b''
def __determine_bpi(self, data, frames, EMPTY=b'\x00' * 10):
if self.version < self._V24:
return int
# have to special case whether to use bitpaddedints here
# spec says to use them, but iTunes has it wrong
# count number of tags found as BitPaddedInt and how far past
o = 0
asbpi = 0
while o < len(data) - 10:
part = data[o:o + 10]
if part == EMPTY:
bpioff = -((len(data) - o) % 10)
break
name, size, flags = unpack('>4sLH', part)
size = BitPaddedInt(size)
o += 10 + size
if name in frames:
asbpi += 1
else:
bpioff = o - len(data)
# count number of tags found as int and how far past
o = 0
asint = 0
while o < len(data) - 10:
part = data[o:o + 10]
if part == EMPTY:
intoff = -((len(data) - o) % 10)
break
name, size, flags = unpack('>4sLH', part)
o += 10 + size
if name in frames:
asint += 1
else:
intoff = o - len(data)
# if more tags as int, or equal and bpi is past and int is not
if asint > asbpi or (asint == asbpi and (bpioff >= 1 and intoff <= 1)):
return int
return BitPaddedInt
def __read_frames(self, data, frames):
if self.version < self._V24 and self.f_unsynch:
try:
data = unsynch.decode(data)
except ValueError:
pass
if self._V23 <= self.version:
bpi = self.__determine_bpi(data, frames)
while data:
header = data[:10]
try:
name, size, flags = unpack('>4sLH', header)
except struct.error:
return # not enough header
if name.strip(b'\x00') == b'':
return
name = name.decode('latin1')
size = bpi(size)
framedata = data[10:10+size]
data = data[10+size:]
if size == 0:
continue # drop empty frames
try:
tag = frames[name]
except KeyError:
if is_valid_frame_id(name):
yield header + framedata
else:
try:
yield self.__load_framedata(tag, flags, framedata)
except NotImplementedError:
yield header + framedata
except ID3JunkFrameError:
pass
elif self._V22 <= self.version:
while data:
header = data[0:6]
try:
name, size = unpack('>3s3s', header)
except struct.error:
return # not enough header
size, = struct.unpack('>L', b'\x00'+size)
if name.strip(b'\x00') == b'':
return
name = name.decode('latin1')
framedata = data[6:6+size]
data = data[6+size:]
if size == 0:
continue # drop empty frames
try:
tag = frames[name]
except KeyError:
if is_valid_frame_id(name):
yield header + framedata
else:
try:
yield self.__load_framedata(tag, 0, framedata)
except NotImplementedError:
yield header + framedata
except ID3JunkFrameError:
pass
def __load_framedata(self, tag, flags, framedata):
return tag.fromData(self, flags, framedata)
f_unsynch = property(lambda s: bool(s.__flags & 0x80))
f_extended = property(lambda s: bool(s.__flags & 0x40))
f_experimental = property(lambda s: bool(s.__flags & 0x20))
f_footer = property(lambda s: bool(s.__flags & 0x10))
#f_crc = property(lambda s: bool(s.__extflags & 0x8000))
def _prepare_framedata(self, v2_version, v23_sep):
if v2_version == 3:
version = self._V23
elif v2_version == 4:
version = self._V24
else:
raise ValueError("Only 3 or 4 allowed for v2_version")
# Sort frames by 'importance'
order = ["TIT2", "TPE1", "TRCK", "TALB", "TPOS", "TDRC", "TCON"]
#PY26 - Change this to dictionary comprehension
order = dict((b, a) for a, b in enumerate(order))
last = len(order)
frames = sorted(self.items(), key=lambda a: (order.get(a[0][:4], last), a[0]))
framedata = [self.__save_frame(frame, version=version, v23_sep=v23_sep)
for (key, frame) in frames]
# only write unknown frames if they were loaded from the version
# we are saving with or upgraded to it
if self.__unknown_version == version:
framedata.extend(data for data in self.unknown_frames
if len(data) > 10)
return b''.join(framedata)
def _prepare_id3_header(self, original_header, framesize, v2_version):
try:
id3, vmaj, vrev, flags, insize = unpack('>3sBBB4s', original_header)
except struct.error:
id3, insize = b'', 0
insize = BitPaddedInt(insize)
if id3 != b'ID3':
insize = -10
if insize >= framesize:
outsize = insize
else:
outsize = (framesize + 1023) & ~0x3FF
framesize = BitPaddedInt.to_str(outsize, width=4)
header = pack('>3sBBB4s', b'ID3', v2_version, 0, 0, framesize)
return (header, outsize, insize)
def save(self, filename=None, v1=1, v2_version=4, v23_sep='/'):
"""Save changes to a file.
If no filename is given, the one most recently loaded is used.
Keyword arguments:
v1 -- if 0, ID3v1 tags will be removed
if 1, ID3v1 tags will be updated but not added
if 2, ID3v1 tags will be created and/or updated
v2 -- version of ID3v2 tags (3 or 4).
By default Mutagen saves ID3v2.4 tags. If you want to save ID3v2.3
tags, you must call method update_to_v23 before saving the file.
v23_sep -- the separator used to join multiple text values
if v2_version == 3. Defaults to '/' but if it's None
will be the ID3v2v2.4 null separator.
The lack of a way to update only an ID3v1 tag is intentional.
"""
framedata = self._prepare_framedata(v2_version, v23_sep)
framesize = len(framedata)
if not framedata:
try:
self.delete(filename)
except EnvironmentError as err:
from errno import ENOENT
if err.errno != ENOENT:
raise
return
if filename is None:
filename = self.filename
try:
f = open(filename, 'rb+')
except IOError as err:
from errno import ENOENT
if err.errno != ENOENT:
raise
f = open(filename, 'ab') # create, then reopen
f = open(filename, 'rb+')
try:
idata = f.read(10)
header = self._prepare_id3_header(idata, framesize, v2_version)
header, outsize, insize = header
data = header + framedata + (b'\x00' * (outsize - framesize))
if (insize < outsize):
insert_bytes(f, outsize-insize, insize+10)
f.seek(0)
f.write(data)
try:
f.seek(-128, 2)
except IOError as err:
# If the file is too small, that's OK - it just means
# we're certain it doesn't have a v1 tag.
from errno import EINVAL
if err.errno != EINVAL:
# If we failed to see for some other reason, bail out.
raise
# Since we're sure this isn't a v1 tag, don't read it.
f.seek(0, 2)
data = f.read(128)
try:
idx = data.index(b"TAG")
except ValueError:
offset = 0
has_v1 = False
else:
offset = idx - len(data)
has_v1 = True
f.seek(offset, 2)
if v1 == 1 and has_v1 or v1 == 2:
f.write(MakeID3v1(self))
else:
f.truncate()
finally:
f.close()
def delete(self, filename=None, delete_v1=True, delete_v2=True):
"""Remove tags from a file.
If no filename is given, the one most recently loaded is used.
Keyword arguments:
* delete_v1 -- delete any ID3v1 tag
* delete_v2 -- delete any ID3v2 tag
"""
if filename is None:
filename = self.filename
delete(filename, delete_v1, delete_v2)
self.clear()
def __save_frame(self, frame, name=None, version=_V24, v23_sep=None):
flags = 0
if self.PEDANTIC and isinstance(frame, TextFrame):
if len(str(frame)) == 0:
return b''
if version == self._V23:
framev23 = frame._get_v23_frame(sep=v23_sep)
framedata = framev23._writeData()
else:
framedata = frame._writeData()
usize = len(framedata)
if usize > 2048:
# Disabled as this causes iTunes and other programs
# to fail to find these frames, which usually includes
# e.g. APIC.
#framedata = BitPaddedInt.to_str(usize) + framedata.encode('zlib')
#flags |= Frame.FLAG24_COMPRESS | Frame.FLAG24_DATALEN
pass
if version == self._V24:
bits = 7
elif version == self._V23:
bits = 8
else:
raise ValueError
datasize = BitPaddedInt.to_str(len(framedata), width=4, bits=bits)
n = (name or type(frame).__name__).encode("ascii")
header = pack('>4s4sH', n, datasize, flags)
return header + framedata
def __update_common(self):
"""Updates done by both v23 and v24 update"""
if "TCON" in self:
# Get rid of "(xx)Foobr" format.
self["TCON"].genres = self["TCON"].genres
if self.version < self._V23:
# ID3v2.2 PIC frames are slightly different.
pics = self.getall("APIC")
mimes = {"PNG": "image/png", "JPG": "image/jpeg"}
self.delall("APIC")
for pic in pics:
newpic = APIC(
encoding=pic.encoding, mime=mimes.get(pic.mime, pic.mime),
type=pic.type, desc=pic.desc, data=pic.data)
self.add(newpic)
# ID3v2.2 LNK frames are just way too different to upgrade.
self.delall("LINK")
def update_to_v24(self):
"""Convert older tags into an ID3v2.4 tag.
This updates old ID3v2 frames to ID3v2.4 ones (e.g. TYER to
TDRC). If you intend to save tags, you must call this function
at some point; it is called by default when loading the tag.
"""
self.__update_common()
if self.__unknown_version == self._V23:
# convert unknown 2.3 frames (flags/size) to 2.4
converted = []
for frame in self.unknown_frames:
try:
name, size, flags = unpack('>4sLH', frame[:10])
frame = BinaryFrame.fromData(self, flags, frame[10:])
except (struct.error, error):
continue
name = name.decode('ascii')
converted.append(self.__save_frame(frame, name=name))
self.unknown_frames[:] = converted
self.__unknown_version = self._V24
# TDAT, TYER, and TIME have been turned into TDRC.
try:
date = text_type(self.get("TYER", ""))
if date.strip(u"\x00"):
self.pop("TYER")
dat = text_type(self.get("TDAT", ""))
if dat.strip("\x00"):
self.pop("TDAT")
date = "%s-%s-%s" % (date, dat[2:], dat[:2])
time = text_type(self.get("TIME", ""))
if time.strip("\x00"):
self.pop("TIME")
date += "T%s:%s:00" % (time[:2], time[2:])
if "TDRC" not in self:
self.add(TDRC(encoding=0, text=date))
except UnicodeDecodeError:
# Old ID3 tags have *lots* of Unicode problems, so if TYER
# is bad, just chuck the frames.
pass
# TORY can be the first part of a TDOR.
if "TORY" in self:
f = self.pop("TORY")
if "TDOR" not in self:
try:
self.add(TDOR(encoding=0, text=str(f)))
except UnicodeDecodeError:
pass
# IPLS is now TIPL.
if "IPLS" in self:
f = self.pop("IPLS")
if "TIPL" not in self:
self.add(TIPL(encoding=f.encoding, people=f.people))
# These can't be trivially translated to any ID3v2.4 tags, or
# should have been removed already.
for key in ["RVAD", "EQUA", "TRDA", "TSIZ", "TDAT", "TIME", "CRM"]:
if key in self:
del(self[key])
def update_to_v23(self):
"""Convert older (and newer) tags into an ID3v2.3 tag.
This updates incompatible ID3v2 frames to ID3v2.3 ones. If you
intend to save tags as ID3v2.3, you must call this function
at some point.
If you want to to go off spec and include some v2.4 frames
in v2.3, remove them before calling this and add them back afterwards.
"""
self.__update_common()
# we could downgrade unknown v2.4 frames here, but given that
# the main reason to save v2.3 is compatibility and this
# might increase the chance of some parser breaking.. better not
# TMCL, TIPL -> TIPL
if "TIPL" in self or "TMCL" in self:
people = []
if "TIPL" in self:
f = self.pop("TIPL")
people.extend(f.people)
if "TMCL" in self:
f = self.pop("TMCL")
people.extend(f.people)
if "IPLS" not in self:
self.add(IPLS(encoding=f.encoding, people=people))
# TDOR -> TORY
if "TDOR" in self:
f = self.pop("TDOR")
if f.text:
d = f.text[0]
if d.year and "TORY" not in self:
self.add(TORY(encoding=f.encoding, text="%04d" % d.year))
# TDRC -> TYER, TDAT, TIME
if "TDRC" in self:
f = self.pop("TDRC")
if f.text:
d = f.text[0]
if d.year and "TYER" not in self:
self.add(TYER(encoding=f.encoding, text="%04d" % d.year))
if d.month and d.day and "TDAT" not in self:
self.add(TDAT(encoding=f.encoding,
text="%02d%02d" % (d.day, d.month)))
if d.hour and d.minute and "TIME" not in self:
self.add(TIME(encoding=f.encoding,
text="%02d%02d" % (d.hour, d.minute)))
# New frames added in v2.4
v24_frames = [
'ASPI', 'EQU2', 'RVA2', 'SEEK', 'SIGN', 'TDEN', 'TDOR',
'TDRC', 'TDRL', 'TDTG', 'TIPL', 'TMCL', 'TMOO', 'TPRO',
'TSOA', 'TSOP', 'TSOT', 'TSST',
]
for key in v24_frames:
if key in self:
del(self[key])
|
class ID3(DictProxy, mutagen.Metadata):
'''A file with an ID3v2 tag.
Attributes:
* version -- ID3 tag version as a tuple
* unknown_frames -- raw frame data of any unknown frames found
* size -- the total size of the ID3 tag, including the header
'''
def __init__(self, *args, **kwargs):
pass
def __fullread(self, size):
''' Read a certain number of bytes from the source file. '''
pass
def load(self, filename, known_frames=None, translate=True, v2_version=4):
'''Load tags from a filename.
Keyword arguments:
* filename -- filename to load tag data from
* known_frames -- dict mapping frame IDs to Frame objects
* translate -- Update all tags to ID3v2.3/4 internally. If you
intend to save, this must be true or you have to
call update_to_v23() / update_to_v24() manually.
* v2_version -- if update_to_v23 or update_to_v24 get called (3 or 4)
Example of loading a custom frame::
my_frames = dict(mutagen.id3.Frames)
class XMYF(Frame): ...
my_frames["XMYF"] = XMYF
mutagen.id3.ID3(filename, known_frames=my_frames)
'''
pass
def getall(self, key):
'''Return all frames with a given name (the list may be empty).
This is best explained by examples::
id3.getall('TIT2') == [id3['TIT2']]
id3.getall('TTTT') == []
id3.getall('TXXX') == [TXXX(desc='woo', text='bar'),
TXXX(desc='baz', text='quuuux'), ...]
Since this is based on the frame's HashKey, which is
colon-separated, you can use it to do things like
``getall('COMM:MusicMatch')`` or ``getall('TXXX:QuodLibet:')``.
'''
pass
def delall(self, key):
'''Delete all tags of a given kind; see getall.'''
pass
def setall(self, key, values):
'''Delete frames of the given type and add frames in 'values'.'''
pass
def pprint(self):
'''Return tags in a human-readable format.
"Human-readable" is used loosely here. The format is intended
to mirror that used for Vorbis or APEv2 output, e.g.
``TIT2=My Title``
However, ID3 frames can have multiple keys:
``POPM=user@example.org=3 128/255``
'''
pass
def loaded_frame(self, tag):
'''Deprecated; use the add method.'''
pass
def add(self, frame):
'''Add a frame to the tag.'''
pass
def _load_header(self):
pass
def __determine_bpi(self, data, frames, EMPTY=b'\x00' * 10):
pass
def __read_frames(self, data, frames):
pass
def __load_framedata(self, tag, flags, framedata):
pass
def _prepare_framedata(self, v2_version, v23_sep):
pass
def _prepare_id3_header(self, original_header, framesize, v2_version):
pass
def save(self, filename=None, v1=1, v2_version=4, v23_sep='/'):
'''Save changes to a file.
If no filename is given, the one most recently loaded is used.
Keyword arguments:
v1 -- if 0, ID3v1 tags will be removed
if 1, ID3v1 tags will be updated but not added
if 2, ID3v1 tags will be created and/or updated
v2 -- version of ID3v2 tags (3 or 4).
By default Mutagen saves ID3v2.4 tags. If you want to save ID3v2.3
tags, you must call method update_to_v23 before saving the file.
v23_sep -- the separator used to join multiple text values
if v2_version == 3. Defaults to '/' but if it's None
will be the ID3v2v2.4 null separator.
The lack of a way to update only an ID3v1 tag is intentional.
'''
pass
def delete(self, filename=None, delete_v1=True, delete_v2=True):
'''Remove tags from a file.
If no filename is given, the one most recently loaded is used.
Keyword arguments:
* delete_v1 -- delete any ID3v1 tag
* delete_v2 -- delete any ID3v2 tag
'''
pass
def __save_frame(self, frame, name=None, version=_V24, v23_sep=None):
pass
def __update_common(self):
'''Updates done by both v23 and v24 update'''
pass
def update_to_v24(self):
'''Convert older tags into an ID3v2.4 tag.
This updates old ID3v2 frames to ID3v2.4 ones (e.g. TYER to
TDRC). If you intend to save tags, you must call this function
at some point; it is called by default when loading the tag.
'''
pass
def update_to_v23(self):
'''Convert older (and newer) tags into an ID3v2.3 tag.
This updates incompatible ID3v2 frames to ID3v2.3 ones. If you
intend to save tags as ID3v2.3, you must call this function
at some point.
If you want to to go off spec and include some v2.4 frames
in v2.3, remove them before calling this and add them back afterwards.
'''
pass
| 22 | 14 | 30 | 4 | 21 | 6 | 7 | 0.3 | 2 | 31 | 18 | 2 | 21 | 7 | 21 | 31 | 688 | 104 | 456 | 122 | 429 | 136 | 423 | 118 | 396 | 21 | 2 | 5 | 140 |
147,149 |
LordSputnik/mutagen
|
LordSputnik_mutagen/mutagen/apev2.py
|
mutagen.apev2.APEv2
|
class APEv2(collections.MutableMapping, Metadata):
"""A file with an APEv2 tag.
ID3v1 tags are silently ignored and overwritten.
"""
filename = None
def __init__(self, *args, **kwargs):
self.__casemap = {}
self.__dict = {}
super(APEv2, self).__init__(*args, **kwargs)
# Internally all names are stored as lowercase, but the case
# they were set with is remembered and used when saving. This
# is roughly in line with the standard, which says that keys
# are case-sensitive but two keys differing only in case are
# not allowed, and recommends case-insensitive
# implementations.
def pprint(self):
"""Return tag key=value pairs in a human-readable format."""
items = sorted(self.items())
return u"\n".join(u"%s=%s" % (k, v.pprint()) for k, v in items)
def load(self, filename):
"""Load tags from a filename."""
self.filename = filename
fileobj = open(filename, "rb")
try:
data = _APEv2Data(fileobj)
finally:
fileobj.close()
if data.tag:
self.clear()
self.__casemap.clear()
self.__parse_tag(data.tag, data.items)
else:
raise APENoHeaderError("No APE tag found")
def __parse_tag(self, tag, count):
fileobj = cBytesIO(tag)
for i in range(count):
size_data = fileobj.read(4)
# someone writes wrong item counts
if not size_data:
break
size = cdata.uint_le(size_data)
flags = cdata.uint_le(fileobj.read(4))
# Bits 1 and 2 bits are flags, 0-3
# Bit 0 is read/write flag, ignored
kind = (flags & 6) >> 1
if kind == 3:
raise APEBadItemError("value type must be 0, 1, or 2")
key = value = fileobj.read(1)
while key[-1:] != b'\x00' and value:
value = fileobj.read(1)
key += value
if key[-1:] == b"\x00":
key = key[:-1]
if PY3:
try:
key = key.decode("ascii")
except UnicodeError as err:
reraise(APEBadItemError, err, sys.exc_info()[2])
value = fileobj.read(size)
if kind == TEXT:
value = APETextValue(value, kind)
elif kind == BINARY:
value = APEBinaryValue(value, kind)
elif kind == EXTERNAL:
value = APEExtValue(value, kind)
self[key] = value
def __getitem__(self, key):
if not is_valid_apev2_key(key):
raise KeyError("%r is not a valid APEv2 key" % key)
if PY2:
key = key.encode('ascii')
return self.__dict[key.lower()]
def __delitem__(self, key):
if not is_valid_apev2_key(key):
raise KeyError("%r is not a valid APEv2 key" % key)
if PY2:
key = key.encode('ascii')
del(self.__casemap[key.lower()])
del(self.__dict[key.lower()])
def __setitem__(self, key, value):
"""'Magic' value setter.
This function tries to guess at what kind of value you want to
store. If you pass in a valid UTF-8 or Unicode string, it
treats it as a text value. If you pass in a list, it treats it
as a list of string/Unicode values. If you pass in a string
that is not valid UTF-8, it assumes it is a binary value.
Python 3: all bytes will be assumed to be a byte value, even
if they are valid utf-8.
If you need to force a specific type of value (e.g. binary
data that also happens to be valid UTF-8, or an external
reference), use the APEValue factory and set the value to the
result of that::
from mutagen.apev2 import APEValue, EXTERNAL
tag['Website'] = APEValue('http://example.org', EXTERNAL)
"""
if not is_valid_apev2_key(key):
raise KeyError("%r is not a valid APEv2 key" % key)
if PY2:
key = key.encode('ascii')
if not isinstance(value, _APEValue):
# let's guess at the content if we're not already a value...
if isinstance(value, text_type):
# unicode? we've got to be text.
value = APEValue(value, TEXT)
elif isinstance(value, list):
items = []
for v in value:
if not isinstance(v, text_type):
if PY3:
raise TypeError("item in list not str")
v = v.decode("utf-8")
items.append(v)
# list? text.
value = APEValue(u"\0".join(items), TEXT)
else:
if PY3:
value = APEValue(value, BINARY)
else:
try:
value.decode("utf-8")
except UnicodeError:
# invalid UTF8 text, probably binary
value = APEValue(value, BINARY)
else:
# valid UTF8, probably text
value = APEValue(value, TEXT)
self.__casemap[key.lower()] = key
self.__dict[key.lower()] = value
def __iter__(self):
return iter(self.__casemap.get(key, key) for key in self.__dict.keys())
def __len__(self):
return len(self.__dict.keys())
def save(self, filename=None):
"""Save changes to a file.
If no filename is given, the one most recently loaded is used.
Tags are always written at the end of the file, and include
a header and a footer.
"""
filename = filename or self.filename
try:
fileobj = open(filename, "r+b")
except IOError:
fileobj = open(filename, "w+b")
data = _APEv2Data(fileobj)
if data.is_at_start:
delete_bytes(fileobj, data.end - data.start, data.start)
elif data.start is not None:
fileobj.seek(data.start)
# Delete an ID3v1 tag if present, too.
fileobj.truncate()
fileobj.seek(0, 2)
# "APE tags items should be sorted ascending by size... This is
# not a MUST, but STRONGLY recommended. Actually the items should
# be sorted by importance/byte, but this is not feasible."
tags = sorted((v._internal(k) for k, v in self.items()), key=len)
num_tags = len(tags)
tags = b"".join(tags)
header = bytearray(b"APETAGEX")
# version, tag size, item count, flags
header += struct.pack("<4I", 2000, len(tags) + 32, num_tags,
HAS_HEADER | IS_HEADER)
header += b"\0" * 8
fileobj.write(header)
fileobj.write(tags)
footer = bytearray(b"APETAGEX")
footer += struct.pack("<4I", 2000, len(tags) + 32, num_tags,
HAS_HEADER)
footer += b"\0" * 8
fileobj.write(footer)
fileobj.close()
def delete(self, filename=None):
"""Remove tags from a file."""
filename = filename or self.filename
fileobj = open(filename, "r+b")
try:
data = _APEv2Data(fileobj)
if data.start is not None and data.size is not None:
delete_bytes(fileobj, data.end - data.start, data.start)
finally:
fileobj.close()
self.clear()
|
class APEv2(collections.MutableMapping, Metadata):
'''A file with an APEv2 tag.
ID3v1 tags are silently ignored and overwritten.
'''
def __init__(self, *args, **kwargs):
pass
def pprint(self):
'''Return tag key=value pairs in a human-readable format.'''
pass
def load(self, filename):
'''Load tags from a filename.'''
pass
def __parse_tag(self, tag, count):
pass
def __getitem__(self, key):
pass
def __delitem__(self, key):
pass
def __setitem__(self, key, value):
''''Magic' value setter.
This function tries to guess at what kind of value you want to
store. If you pass in a valid UTF-8 or Unicode string, it
treats it as a text value. If you pass in a list, it treats it
as a list of string/Unicode values. If you pass in a string
that is not valid UTF-8, it assumes it is a binary value.
Python 3: all bytes will be assumed to be a byte value, even
if they are valid utf-8.
If you need to force a specific type of value (e.g. binary
data that also happens to be valid UTF-8, or an external
reference), use the APEValue factory and set the value to the
result of that::
from mutagen.apev2 import APEValue, EXTERNAL
tag['Website'] = APEValue('http://example.org', EXTERNAL)
'''
pass
def __iter__(self):
pass
def __len__(self):
pass
def save(self, filename=None):
'''Save changes to a file.
If no filename is given, the one most recently loaded is used.
Tags are always written at the end of the file, and include
a header and a footer.
'''
pass
def delete(self, filename=None):
'''Remove tags from a file.'''
pass
| 12 | 6 | 18 | 2 | 12 | 3 | 4 | 0.33 | 2 | 15 | 8 | 0 | 11 | 2 | 11 | 15 | 220 | 39 | 136 | 36 | 124 | 45 | 125 | 35 | 113 | 11 | 2 | 5 | 40 |
147,150 |
LordSputnik/mutagen
|
LordSputnik_mutagen/mutagen/id3.py
|
mutagen.id3.ID3FileType
|
class ID3FileType(mutagen.FileType):
"""An unknown type of file with ID3 tags."""
ID3 = ID3
class _Info(mutagen.StreamInfo):
length = 0
def __init__(self, fileobj, offset):
pass
@staticmethod
def pprint():
return "Unknown format with ID3 tag"
@staticmethod
def score(filename, fileobj, header_data):
return header_data.startswith(b'ID3')
def add_tags(self, ID3=None):
"""Add an empty ID3 tag to the file.
A custom tag reader may be used in instead of the default
mutagen.id3.ID3 object, e.g. an EasyID3 reader.
"""
if ID3 is None:
ID3 = self.ID3
if self.tags is None:
self.ID3 = ID3
self.tags = ID3()
else:
raise error("an ID3 tag already exists")
def load(self, filename, ID3=None, **kwargs):
"""Load stream and tag information from a file.
A custom tag reader may be used in instead of the default
mutagen.id3.ID3 object, e.g. an EasyID3 reader.
"""
if ID3 is None:
ID3 = self.ID3
else:
# If this was initialized with EasyID3, remember that for
# when tags are auto-instantiated in add_tags.
self.ID3 = ID3
self.filename = filename
try:
self.tags = ID3(filename, **kwargs)
except error:
self.tags = None
if self.tags is not None:
try:
offset = self.tags.size
except AttributeError:
offset = None
else:
offset = None
try:
fileobj = open(filename, "rb")
self.info = self._Info(fileobj, offset)
finally:
fileobj.close()
|
class ID3FileType(mutagen.FileType):
'''An unknown type of file with ID3 tags.'''
class _Info(mutagen.StreamInfo):
def __init__(self, fileobj, offset):
pass
@staticmethod
def pprint():
pass
@staticmethod
def score(filename, fileobj, header_data):
pass
def add_tags(self, ID3=None):
'''Add an empty ID3 tag to the file.
A custom tag reader may be used in instead of the default
mutagen.id3.ID3 object, e.g. an EasyID3 reader.
'''
pass
def load(self, filename, ID3=None, **kwargs):
'''Load stream and tag information from a file.
A custom tag reader may be used in instead of the default
mutagen.id3.ID3 object, e.g. an EasyID3 reader.
'''
pass
| 9 | 3 | 10 | 1 | 7 | 2 | 2 | 0.26 | 1 | 3 | 2 | 3 | 2 | 3 | 3 | 16 | 63 | 10 | 42 | 16 | 33 | 11 | 36 | 14 | 29 | 5 | 2 | 2 | 11 |
147,151 |
LordSputnik/mutagen
|
LordSputnik_mutagen/mutagen/flac.py
|
mutagen.flac.FLAC
|
class FLAC(mutagen.FileType):
"""A FLAC audio file.
Attributes:
* info -- stream information (length, bitrate, sample rate)
* tags -- metadata tags, if any
* cuesheet -- CueSheet object, if any
* seektable -- SeekTable object, if any
* pictures -- list of embedded pictures
"""
_mimes = ["audio/x-flac", "application/x-flac"]
METADATA_BLOCKS = [StreamInfo, Padding, None, SeekTable, VCFLACDict,
CueSheet, Picture]
"""Known metadata block types, indexed by ID."""
@staticmethod
def score(filename, fileobj, header_data):
if isinstance(filename, bytes):
filename = filename.decode('utf-8')
filename = filename.lower()
return (header_data.startswith(b"fLaC") +
endswith(filename,".flac") * 3)
def __read_metadata_block(self, fileobj):
byte = ord(fileobj.read(1))
size = to_int_be(fileobj.read(3))
code = byte & 0x7F
last_block = bool(byte & 0x80)
try:
block_type = self.METADATA_BLOCKS[code] or MetadataBlock
except IndexError:
block_type = MetadataBlock
if block_type._distrust_size:
# Some jackass is writing broken Metadata block length
# for Vorbis comment blocks, and the FLAC reference
# implementaton can parse them (mostly by accident),
# so we have to too. Instead of parsing the size
# given, parse an actual Vorbis comment, leaving
# fileobj in the right position.
# http://code.google.com/p/mutagen/issues/detail?id=52
# ..same for the Picture block:
# http://code.google.com/p/mutagen/issues/detail?id=106
block = block_type(fileobj)
else:
data = fileobj.read(size)
block = block_type(data)
block.code = code
if block.code == VCFLACDict.code:
if self.tags is None:
self.tags = block
else:
raise FLACVorbisError("> 1 Vorbis comment block found")
elif block.code == CueSheet.code:
if self.cuesheet is None:
self.cuesheet = block
else:
raise error("> 1 CueSheet block found")
elif block.code == SeekTable.code:
if self.seektable is None:
self.seektable = block
else:
raise error("> 1 SeekTable block found")
self.metadata_blocks.append(block)
return not last_block
def add_tags(self):
"""Add a Vorbis comment block to the file."""
if self.tags is None:
self.tags = VCFLACDict()
self.metadata_blocks.append(self.tags)
else:
raise FLACVorbisError("a Vorbis comment already exists")
add_vorbiscomment = add_tags
def delete(self, filename=None):
"""Remove Vorbis comments from a file.
If no filename is given, the one most recently loaded is used.
"""
if filename is None:
filename = self.filename
for s in list(self.metadata_blocks):
if isinstance(s, VCFLACDict):
self.metadata_blocks.remove(s)
self.tags = None
self.save()
break
vc = property(lambda s: s.tags, doc="Alias for tags; don't use this.")
def load(self, filename):
"""Load file information from a filename."""
self.metadata_blocks = []
self.tags = None
self.cuesheet = None
self.seektable = None
self.filename = filename
fileobj = StrictFileObject(open(filename, "rb"))
try:
self.__check_header(fileobj)
while self.__read_metadata_block(fileobj):
pass
finally:
fileobj.close()
try:
self.metadata_blocks[0].length
except (AttributeError, IndexError):
raise FLACNoHeaderError("Stream info block not found")
@property
def info(self):
return self.metadata_blocks[0]
def add_picture(self, picture):
"""Add a new picture to the file."""
self.metadata_blocks.append(picture)
def clear_pictures(self):
"""Delete all pictures from the file."""
blocks = [b for b in self.metadata_blocks if b.code != Picture.code]
self.metadata_blocks = blocks
@property
def pictures(self):
"""List of embedded pictures"""
return [b for b in self.metadata_blocks if b.code == Picture.code]
def save(self, filename=None, deleteid3=False):
"""Save metadata blocks to a file.
If no filename is given, the one most recently loaded is used.
"""
if filename is None:
filename = self.filename
f = open(filename, 'rb+')
try:
# Ensure we've got padding at the end, and only at the end.
# If adding makes it too large, we'll scale it down later.
self.metadata_blocks.append(Padding(b'\x00' * 1020))
MetadataBlock.group_padding(self.metadata_blocks)
header = self.__check_header(f)
# "fLaC" and maybe ID3
available = self.__find_audio_offset(f) - header
data = MetadataBlock.writeblocks(self.metadata_blocks)
# Delete ID3v2
if deleteid3 and header > 4:
available += header - 4
header = 4
if len(data) > available:
# If we have too much data, see if we can reduce padding.
padding = self.metadata_blocks[-1]
newlength = padding.length - (len(data) - available)
if newlength > 0:
padding.length = newlength
data = MetadataBlock.writeblocks(self.metadata_blocks)
assert len(data) == available
elif len(data) < available:
# If we have too little data, increase padding.
self.metadata_blocks[-1].length += (available - len(data))
data = MetadataBlock.writeblocks(self.metadata_blocks)
assert len(data) == available
if len(data) != available:
# We couldn't reduce the padding enough.
diff = (len(data) - available)
insert_bytes(f, diff, header)
f.seek(header - 4)
f.write(b"fLaC" + data)
# Delete ID3v1
if deleteid3:
try:
f.seek(-128, 2)
except IOError:
pass
else:
if f.read(3) == b"TAG":
f.seek(-128, 2)
f.truncate()
finally:
f.close()
def __find_audio_offset(self, fileobj):
byte = 0x00
while not (byte & 0x80):
byte = ord(fileobj.read(1))
size = to_int_be(fileobj.read(3))
try:
block_type = self.METADATA_BLOCKS[byte & 0x7F]
except IndexError:
block_type = None
if block_type and block_type._distrust_size:
# See comments in read_metadata_block; the size can't
# be trusted for Vorbis comment blocks and Picture block
block_type(fileobj)
else:
fileobj.read(size)
return fileobj.tell()
def __check_header(self, fileobj):
size = 4
header = fileobj.read(4)
if header != b"fLaC":
size = None
if header[:3] == b"ID3":
size = 14 + BitPaddedInt(fileobj.read(6)[2:])
fileobj.seek(size - 4)
if fileobj.read(4) != b"fLaC":
size = None
if size is None:
raise FLACNoHeaderError(
"%r is not a valid FLAC file" % fileobj.name)
return size
|
class FLAC(mutagen.FileType):
'''A FLAC audio file.
Attributes:
* info -- stream information (length, bitrate, sample rate)
* tags -- metadata tags, if any
* cuesheet -- CueSheet object, if any
* seektable -- SeekTable object, if any
* pictures -- list of embedded pictures
'''
@staticmethod
def score(filename, fileobj, header_data):
pass
def __read_metadata_block(self, fileobj):
pass
def add_tags(self):
'''Add a Vorbis comment block to the file.'''
pass
def delete(self, filename=None):
'''Remove Vorbis comments from a file.
If no filename is given, the one most recently loaded is used.
'''
pass
def load(self, filename):
'''Load file information from a filename.'''
pass
@property
def info(self):
pass
def add_picture(self, picture):
'''Add a new picture to the file.'''
pass
def clear_pictures(self):
'''Delete all pictures from the file.'''
pass
@property
def pictures(self):
'''List of embedded pictures'''
pass
def save(self, filename=None, deleteid3=False):
'''Save metadata blocks to a file.
If no filename is given, the one most recently loaded is used.
'''
pass
def __find_audio_offset(self, fileobj):
pass
def __check_header(self, fileobj):
pass
| 16 | 8 | 16 | 2 | 12 | 3 | 4 | 0.25 | 1 | 16 | 11 | 0 | 11 | 5 | 12 | 25 | 233 | 38 | 156 | 47 | 140 | 39 | 139 | 44 | 126 | 10 | 2 | 4 | 43 |
147,152 |
LordSputnik/mutagen
|
LordSputnik_mutagen/mutagen/flac.py
|
mutagen.flac.CueSheetTrackIndex
|
class CueSheetTrackIndex(tuple):
"""Index for a track in a cuesheet.
For CD-DA, an index_number of 0 corresponds to the track
pre-gap. The first index in a track must have a number of 0 or 1,
and subsequently, index_numbers must increase by 1. Index_numbers
must be unique within a track. And index_offset must be evenly
divisible by 588 samples.
Attributes:
* index_number -- index point number
* index_offset -- offset in samples from track start
"""
def __new__(cls, index_number, index_offset):
return super(cls, CueSheetTrackIndex).__new__(
cls, (index_number, index_offset))
index_number = property(lambda self: self[0])
index_offset = property(lambda self: self[1])
|
class CueSheetTrackIndex(tuple):
'''Index for a track in a cuesheet.
For CD-DA, an index_number of 0 corresponds to the track
pre-gap. The first index in a track must have a number of 0 or 1,
and subsequently, index_numbers must increase by 1. Index_numbers
must be unique within a track. And index_offset must be evenly
divisible by 588 samples.
Attributes:
* index_number -- index point number
* index_offset -- offset in samples from track start
'''
def __new__(cls, index_number, index_offset):
pass
| 2 | 1 | 3 | 0 | 3 | 0 | 1 | 1.67 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 21 | 21 | 5 | 6 | 4 | 4 | 10 | 5 | 4 | 3 | 1 | 2 | 0 | 1 |
147,153 |
LordSputnik/mutagen
|
LordSputnik_mutagen/mutagen/flac.py
|
mutagen.flac.CueSheetTrack
|
class CueSheetTrack(object):
"""A track in a cuesheet.
For CD-DA, track_numbers must be 1-99, or 170 for the
lead-out. Track_numbers must be unique within a cue sheet. There
must be atleast one index in every track except the lead-out track
which must have none.
Attributes:
* track_number -- track number
* start_offset -- track offset in samples from start of FLAC stream
* isrc -- ISRC code
* type -- 0 for audio, 1 for digital data
* pre_emphasis -- true if the track is recorded with pre-emphasis
* indexes -- list of CueSheetTrackIndex objects
"""
def __init__(self, track_number, start_offset, isrc='', type_=0,
pre_emphasis=False):
self.track_number = track_number
self.start_offset = start_offset
self.isrc = isrc
self.type = type_
self.pre_emphasis = pre_emphasis
self.indexes = []
def __eq__(self, other):
try:
return (self.track_number == other.track_number and
self.start_offset == other.start_offset and
self.isrc == other.isrc and
self.type == other.type and
self.pre_emphasis == other.pre_emphasis and
self.indexes == other.indexes)
except (AttributeError, TypeError):
return False
__hash__ = object.__hash__
def __repr__(self):
return ("<%s number=%r, offset=%d, isrc=%r, type=%r, "
"pre_emphasis=%r, indexes=%r)>") % (
type(self).__name__, self.track_number, self.start_offset,
self.isrc, self.type, self.pre_emphasis, self.indexes)
|
class CueSheetTrack(object):
'''A track in a cuesheet.
For CD-DA, track_numbers must be 1-99, or 170 for the
lead-out. Track_numbers must be unique within a cue sheet. There
must be atleast one index in every track except the lead-out track
which must have none.
Attributes:
* track_number -- track number
* start_offset -- track offset in samples from start of FLAC stream
* isrc -- ISRC code
* type -- 0 for audio, 1 for digital data
* pre_emphasis -- true if the track is recorded with pre-emphasis
* indexes -- list of CueSheetTrackIndex objects
'''
def __init__(self, track_number, start_offset, isrc='', type_=0,
pre_emphasis=False):
pass
def __eq__(self, other):
pass
def __repr__(self):
pass
| 4 | 1 | 8 | 0 | 8 | 0 | 1 | 0.52 | 1 | 3 | 0 | 0 | 3 | 6 | 3 | 3 | 45 | 7 | 25 | 12 | 20 | 13 | 16 | 11 | 12 | 2 | 1 | 1 | 4 |
147,154 |
LordSputnik/mutagen
|
LordSputnik_mutagen/mutagen/monkeysaudio.py
|
mutagen.monkeysaudio.MonkeysAudioInfo
|
class MonkeysAudioInfo(StreamInfo):
"""Monkey's Audio stream information.
Attributes:
* channels -- number of audio channels
* length -- file length in seconds, as a float
* sample_rate -- audio sampling rate in Hz
* bits_per_sample -- bits per sample
* version -- Monkey's Audio stream version, as a float (eg: 3.99)
"""
def __init__(self, fileobj):
header = fileobj.read(76)
if len(header) != 76 or not header.startswith(b'MAC '):
raise MonkeysAudioHeaderError("not a Monkey's Audio file")
self.version = cdata.ushort_le(header[4:6])
if self.version >= 3980:
(blocks_per_frame, final_frame_blocks, total_frames,
self.bits_per_sample, self.channels,
self.sample_rate) = struct.unpack("<IIIHHI", header[56:76])
else:
compression_level = cdata.ushort_le(header[6:8])
self.channels, self.sample_rate = struct.unpack(
"<HI", header[10:16])
total_frames, final_frame_blocks = struct.unpack(
"<II", header[24:32])
if self.version >= 3950:
blocks_per_frame = 73728 * 4
elif self.version >= 3900 or (self.version >= 3800 and
compression_level == 4):
blocks_per_frame = 73728
else:
blocks_per_frame = 9216
self.version /= 1000.0
self.length = 0.0
if (self.sample_rate != 0) and (total_frames > 0):
total_blocks = ((total_frames - 1) * blocks_per_frame +
final_frame_blocks)
self.length = float(total_blocks) / self.sample_rate
def pprint(self):
return "Monkey's Audio %.2f, %.2f seconds, %d Hz" % (
self.version, self.length, self.sample_rate)
|
class MonkeysAudioInfo(StreamInfo):
'''Monkey's Audio stream information.
Attributes:
* channels -- number of audio channels
* length -- file length in seconds, as a float
* sample_rate -- audio sampling rate in Hz
* bits_per_sample -- bits per sample
* version -- Monkey's Audio stream version, as a float (eg: 3.99)
'''
def __init__(self, fileobj):
pass
def pprint(self):
pass
| 3 | 1 | 16 | 0 | 16 | 0 | 4 | 0.25 | 1 | 3 | 2 | 0 | 2 | 5 | 2 | 3 | 44 | 4 | 32 | 11 | 29 | 8 | 22 | 9 | 19 | 6 | 2 | 2 | 7 |
147,155 |
LordSputnik/mutagen
|
LordSputnik_mutagen/mutagen/mp3.py
|
mutagen.mp3.EasyMP3
|
class EasyMP3(MP3):
"""Like MP3, but uses EasyID3 for tags.
:ivar info: :class:`MPEGInfo`
:ivar tags: :class:`EasyID3 <mutagen.easyid3.EasyID3>`
"""
from mutagen.easyid3 import EasyID3 as ID3
ID3 = ID3
|
class EasyMP3(MP3):
'''Like MP3, but uses EasyID3 for tags.
:ivar info: :class:`MPEGInfo`
:ivar tags: :class:`EasyID3 <mutagen.easyid3.EasyID3>`
'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1.33 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 18 | 9 | 2 | 3 | 2 | 1 | 4 | 3 | 2 | 1 | 0 | 4 | 0 | 0 |
147,156 |
LordSputnik/mutagen
|
LordSputnik_mutagen/mutagen/mp3.py
|
mutagen.mp3.HeaderNotFoundError
|
class HeaderNotFoundError(error, IOError):
pass
|
class HeaderNotFoundError(error, IOError):
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 11 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 5 | 0 | 0 |
147,157 |
LordSputnik/mutagen
|
LordSputnik_mutagen/mutagen/mp3.py
|
mutagen.mp3.InvalidMPEGHeader
|
class InvalidMPEGHeader(error, IOError):
pass
|
class InvalidMPEGHeader(error, IOError):
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 11 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 5 | 0 | 0 |
147,158 |
LordSputnik/mutagen
|
LordSputnik_mutagen/mutagen/flac.py
|
mutagen.flac.CueSheet
|
class CueSheet(MetadataBlock):
"""Read and write FLAC embedded cue sheets.
Number of tracks should be from 1 to 100. There should always be
exactly one lead-out track and that track must be the last track
in the cue sheet.
Attributes:
* media_catalog_number -- media catalog number in ASCII
* lead_in_samples -- number of lead-in samples
* compact_disc -- true if the cuesheet corresponds to a compact disc
* tracks -- list of CueSheetTrack objects
* lead_out -- lead-out as CueSheetTrack or None if lead-out was not found
"""
__CUESHEET_FORMAT = '>128sQB258xB'
__CUESHEET_SIZE = struct.calcsize(__CUESHEET_FORMAT)
__CUESHEET_TRACK_FORMAT = '>QB12sB13xB'
__CUESHEET_TRACK_SIZE = struct.calcsize(__CUESHEET_TRACK_FORMAT)
__CUESHEET_TRACKINDEX_FORMAT = '>QB3x'
__CUESHEET_TRACKINDEX_SIZE = struct.calcsize(__CUESHEET_TRACKINDEX_FORMAT)
code = 5
media_catalog_number = b''
lead_in_samples = 88200
compact_disc = True
def __init__(self, data):
self.tracks = []
super(CueSheet, self).__init__(data)
def __eq__(self, other):
try:
return (self.media_catalog_number == other.media_catalog_number and
self.lead_in_samples == other.lead_in_samples and
self.compact_disc == other.compact_disc and
self.tracks == other.tracks)
except (AttributeError, TypeError):
return False
__hash__ = MetadataBlock.__hash__
def load(self, data):
header = data.read(self.__CUESHEET_SIZE)
media_catalog_number, lead_in_samples, flags, num_tracks = \
struct.unpack(self.__CUESHEET_FORMAT, header)
self.media_catalog_number = media_catalog_number.rstrip(b'\0')
self.lead_in_samples = lead_in_samples
self.compact_disc = bool(flags & 0x80)
self.tracks = []
for i in range(num_tracks):
track = data.read(self.__CUESHEET_TRACK_SIZE)
start_offset, track_number, isrc_padded, flags, num_indexes = \
struct.unpack(self.__CUESHEET_TRACK_FORMAT, track)
isrc = isrc_padded.rstrip(b'\0')
type_ = (flags & 0x80) >> 7
pre_emphasis = bool(flags & 0x40)
val = CueSheetTrack(
track_number, start_offset, isrc, type_, pre_emphasis)
for j in range(num_indexes):
index = data.read(self.__CUESHEET_TRACKINDEX_SIZE)
index_offset, index_number = struct.unpack(
self.__CUESHEET_TRACKINDEX_FORMAT, index)
val.indexes.append(
CueSheetTrackIndex(index_number, index_offset))
self.tracks.append(val)
def write(self):
f = cBytesIO()
flags = 0
if self.compact_disc:
flags |= 0x80
packed = struct.pack(
self.__CUESHEET_FORMAT, self.media_catalog_number,
self.lead_in_samples, flags, len(self.tracks))
f.write(packed)
for track in self.tracks:
track_flags = 0
track_flags |= (track.type & 1) << 7
if track.pre_emphasis:
track_flags |= 0x40
track_packed = struct.pack(
self.__CUESHEET_TRACK_FORMAT, track.start_offset,
track.track_number, track.isrc, track_flags,
len(track.indexes))
f.write(track_packed)
for index in track.indexes:
index_packed = struct.pack(
self.__CUESHEET_TRACKINDEX_FORMAT,
index.index_offset, index.index_number)
f.write(index_packed)
return f.getvalue()
def __repr__(self):
return ("<%s media_catalog_number=%r, lead_in=%r, compact_disc=%r, "
"tracks=%r>") % (
type(self).__name__, self.media_catalog_number,
self.lead_in_samples, self.compact_disc, self.tracks)
|
class CueSheet(MetadataBlock):
'''Read and write FLAC embedded cue sheets.
Number of tracks should be from 1 to 100. There should always be
exactly one lead-out track and that track must be the last track
in the cue sheet.
Attributes:
* media_catalog_number -- media catalog number in ASCII
* lead_in_samples -- number of lead-in samples
* compact_disc -- true if the cuesheet corresponds to a compact disc
* tracks -- list of CueSheetTrack objects
* lead_out -- lead-out as CueSheetTrack or None if lead-out was not found
'''
def __init__(self, data):
pass
def __eq__(self, other):
pass
def load(self, data):
pass
def write(self):
pass
def __repr__(self):
pass
| 6 | 1 | 13 | 0 | 13 | 0 | 2 | 0.14 | 1 | 8 | 2 | 0 | 5 | 1 | 5 | 10 | 100 | 12 | 77 | 38 | 71 | 11 | 59 | 38 | 53 | 5 | 2 | 2 | 12 |
147,159 |
LordSputnik/mutagen
|
LordSputnik_mutagen/mutagen/easymp4.py
|
mutagen.easymp4.EasyMP4Tags
|
class EasyMP4Tags(collections.MutableMapping, Metadata):
"""A file with MPEG-4 iTunes metadata.
Like Vorbis comments, EasyMP4Tags keys are case-insensitive ASCII
strings, and values are a list of Unicode strings (and these lists
are always of length 0 or 1).
If you need access to the full MP4 metadata feature set, you should use
MP4, not EasyMP4.
"""
Set = {}
Get = {}
Delete = {}
List = {}
def __init__(self, *args, **kwargs):
self.__mp4 = MP4Tags(*args, **kwargs)
self.load = self.__mp4.load
self.save = self.__mp4.save
self.delete = self.__mp4.delete
filename = property(lambda s: s.__mp4.filename,
lambda s, fn: setattr(s.__mp4, 'filename', fn))
@classmethod
def RegisterKey(cls, key,
getter=None, setter=None, deleter=None, lister=None):
"""Register a new key mapping.
A key mapping is four functions, a getter, setter, deleter,
and lister. The key may be either a string or a glob pattern.
The getter, deleted, and lister receive an MP4Tags instance
and the requested key name. The setter also receives the
desired value, which will be a list of strings.
The getter, setter, and deleter are used to implement __getitem__,
__setitem__, and __delitem__.
The lister is used to implement keys(). It should return a
list of keys that are actually in the MP4 instance, provided
by its associated getter.
"""
key = key.lower()
if getter is not None:
cls.Get[key] = getter
if setter is not None:
cls.Set[key] = setter
if deleter is not None:
cls.Delete[key] = deleter
if lister is not None:
cls.List[key] = lister
@classmethod
def RegisterTextKey(cls, key, atomid):
"""Register a text key.
If the key you need to register is a simple one-to-one mapping
of MP4 atom name to EasyMP4Tags key, then you can use this
function::
EasyMP4Tags.RegisterTextKey("artist", b"\xa9ART")
"""
def getter(tags, key):
return tags[atomid]
def setter(tags, key, value):
tags[atomid] = value
def deleter(tags, key):
del(tags[atomid])
cls.RegisterKey(key, getter, setter, deleter)
@classmethod
def RegisterIntKey(cls, key, atomid, min_value=0, max_value=2**16-1):
"""Register a scalar integer key.
"""
def getter(tags, key):
return list(map(text_type, tags[atomid]))
def setter(tags, key, value):
clamp = lambda x: min(max(min_value, x), max_value)
tags[atomid] = [clamp(v) for v in map(int, value)]
def deleter(tags, key):
del(tags[atomid])
cls.RegisterKey(key, getter, setter, deleter)
@classmethod
def RegisterIntPairKey(cls, key, atomid, min_value=0, max_value=2**16-1):
def getter(tags, key):
ret = []
for (track, total) in tags[atomid]:
if total:
ret.append(u"%d/%d" % (track, total))
else:
ret.append(text_type(track))
return ret
def setter(tags, key, value):
clamp = lambda x: int(min(max(min_value, x), max_value))
data = []
for v in value:
try:
tracks, total = v.split("/")
tracks = clamp(int(tracks))
total = clamp(int(total))
except (ValueError, TypeError):
tracks = clamp(int(v))
total = min_value
data.append((tracks, total))
tags[atomid] = data
def deleter(tags, key):
del(tags[atomid])
cls.RegisterKey(key, getter, setter, deleter)
@classmethod
def RegisterFreeformKey(cls, key, name, mean=b"com.apple.iTunes"):
"""Register a text key.
If the key you need to register is a simple one-to-one mapping
of MP4 freeform atom (----) and name to EasyMP4Tags key, then
you can use this function::
EasyMP4Tags.RegisterFreeformKey(
"musicbrainz_artistid", b"MusicBrainz Artist Id")
"""
atomid = b"----:" + mean + b":" + name
def getter(tags, key):
return [s.decode("utf-8", "replace") for s in tags[atomid]]
def setter(tags, key, value):
tags[atomid] = [utf8(v) for v in value]
def deleter(tags, key):
del(tags[atomid])
cls.RegisterKey(key, getter, setter, deleter)
def __getitem__(self, key):
key = key.lower()
func = dict_match(self.Get, key)
if func is not None:
return func(self.__mp4, key)
else:
raise EasyMP4KeyError("%r is not a valid key" % key)
def __setitem__(self, key, value):
key = key.lower()
if PY2:
if isinstance(value, basestring):
value = [value]
else:
if isinstance(value, text_type):
value = [value]
func = dict_match(self.Set, key)
if func is not None:
return func(self.__mp4, key, value)
else:
raise EasyMP4KeyError("%r is not a valid key" % key)
def __delitem__(self, key):
key = key.lower()
func = dict_match(self.Delete, key)
if func is not None:
return func(self.__mp4, key)
else:
raise EasyMP4KeyError("%r is not a valid key" % key)
def __iter__(self):
keys = []
for key in self.Get.keys():
if key in self.List:
keys.extend(self.List[key](self.__mp4, key))
elif key in self:
keys.append(key)
return iter(keys)
def __len__(self):
keys = []
for key in self.Get.keys():
if key in self.List:
keys.extend(self.List[key](self.__mp4, key))
elif key in self:
keys.append(key)
return len(keys)
def pprint(self):
"""Print tag key=value pairs."""
strings = []
for key in sorted(self.keys()):
values = self[key]
for value in values:
strings.append("%s=%s" % (key, value))
return "\n".join(strings)
|
class EasyMP4Tags(collections.MutableMapping, Metadata):
'''A file with MPEG-4 iTunes metadata.
Like Vorbis comments, EasyMP4Tags keys are case-insensitive ASCII
strings, and values are a list of Unicode strings (and these lists
are always of length 0 or 1).
If you need access to the full MP4 metadata feature set, you should use
MP4, not EasyMP4.
'''
def __init__(self, *args, **kwargs):
pass
@classmethod
def RegisterKey(cls, key,
getter=None, setter=None, deleter=None, lister=None):
'''Register a new key mapping.
A key mapping is four functions, a getter, setter, deleter,
and lister. The key may be either a string or a glob pattern.
The getter, deleted, and lister receive an MP4Tags instance
and the requested key name. The setter also receives the
desired value, which will be a list of strings.
The getter, setter, and deleter are used to implement __getitem__,
__setitem__, and __delitem__.
The lister is used to implement keys(). It should return a
list of keys that are actually in the MP4 instance, provided
by its associated getter.
'''
pass
@classmethod
def RegisterTextKey(cls, key, atomid):
'''Register a text key.
If the key you need to register is a simple one-to-one mapping
of MP4 atom name to EasyMP4Tags key, then you can use this
function::
EasyMP4Tags.RegisterTextKey("artist", b"©ART")
'''
pass
def getter(tags, key):
pass
def setter(tags, key, value):
pass
def deleter(tags, key):
pass
@classmethod
def RegisterIntKey(cls, key, atomid, min_value=0, max_value=2**16-1):
'''Register a scalar integer key.
'''
pass
def getter(tags, key):
pass
def setter(tags, key, value):
pass
def deleter(tags, key):
pass
@classmethod
def RegisterIntPairKey(cls, key, atomid, min_value=0, max_value=2**16-1):
pass
def getter(tags, key):
pass
def setter(tags, key, value):
pass
def deleter(tags, key):
pass
@classmethod
def RegisterFreeformKey(cls, key, name, mean=b"com.apple.iTunes"):
'''Register a text key.
If the key you need to register is a simple one-to-one mapping
of MP4 freeform atom (----) and name to EasyMP4Tags key, then
you can use this function::
EasyMP4Tags.RegisterFreeformKey(
"musicbrainz_artistid", b"MusicBrainz Artist Id")
'''
pass
def getter(tags, key):
pass
def setter(tags, key, value):
pass
def deleter(tags, key):
pass
def __getitem__(self, key):
pass
def __setitem__(self, key, value):
pass
def __delitem__(self, key):
pass
def __iter__(self):
pass
def __len__(self):
pass
def pprint(self):
'''Print tag key=value pairs.'''
pass
| 30 | 6 | 9 | 1 | 7 | 1 | 2 | 0.27 | 2 | 7 | 2 | 0 | 7 | 4 | 12 | 16 | 204 | 40 | 129 | 59 | 98 | 35 | 115 | 53 | 90 | 5 | 2 | 2 | 46 |
147,160 |
LordSputnik/mutagen
|
LordSputnik_mutagen/mutagen/easymp4.py
|
mutagen.easymp4.EasyMP4
|
class EasyMP4(MP4):
"""Like :class:`MP4 <mutagen.mp4.MP4>`,
but uses :class:`EasyMP4Tags` for tags.
:ivar info: :class:`MP4Info <mutagen.mp4.MP4Info>`
:ivar tags: :class:`EasyMP4Tags`
"""
MP4Tags = EasyMP4Tags
Get = EasyMP4Tags.Get
Set = EasyMP4Tags.Set
Delete = EasyMP4Tags.Delete
List = EasyMP4Tags.List
RegisterTextKey = EasyMP4Tags.RegisterTextKey
RegisterKey = EasyMP4Tags.RegisterKey
|
class EasyMP4(MP4):
'''Like :class:`MP4 <mutagen.mp4.MP4>`,
but uses :class:`EasyMP4Tags` for tags.
:ivar info: :class:`MP4Info <mutagen.mp4.MP4Info>`
:ivar tags: :class:`EasyMP4Tags`
'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.63 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 16 | 16 | 3 | 8 | 8 | 7 | 5 | 8 | 8 | 7 | 0 | 3 | 0 | 0 |
147,161 |
LordSputnik/mutagen
|
LordSputnik_mutagen/mutagen/monkeysaudio.py
|
mutagen.monkeysaudio.MonkeysAudio
|
class MonkeysAudio(APEv2File):
_Info = MonkeysAudioInfo
_mimes = ["audio/ape", "audio/x-ape"]
@staticmethod
def score(filename, fileobj, header):
if isinstance(filename, bytes):
filename = filename.decode('utf-8')
filename = filename.lower()
return header.startswith(b'MAC ') + endswith(filename, ".ape")
|
class MonkeysAudio(APEv2File):
@staticmethod
def score(filename, fileobj, header):
pass
| 3 | 0 | 6 | 1 | 5 | 0 | 2 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 17 | 11 | 2 | 9 | 5 | 6 | 0 | 8 | 4 | 6 | 2 | 3 | 1 | 2 |
147,162 |
LordSputnik/mutagen
|
LordSputnik_mutagen/mutagen/apev2.py
|
mutagen.apev2.APEUnsupportedVersionError
|
class APEUnsupportedVersionError(error, ValueError):
pass
|
class APEUnsupportedVersionError(error, ValueError):
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 11 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 4 | 0 | 0 |
147,163 |
LordSputnik/mutagen
|
LordSputnik_mutagen/mutagen/easyid3.py
|
mutagen.easyid3.EasyID3
|
class EasyID3(MutableMapping, mutagen.Metadata):
"""A file with an ID3 tag.
Like Vorbis comments, EasyID3 keys are case-insensitive ASCII
strings. Only a subset of ID3 frames are supported by default. Use
EasyID3.RegisterKey and its wrappers to support more.
You can also set the GetFallback, SetFallback, and DeleteFallback
to generic key getter/setter/deleter functions, which are called
if no specific handler is registered for a key. Additionally,
ListFallback can be used to supply an arbitrary list of extra
keys. These can be set on EasyID3 or on individual instances after
creation.
To use an EasyID3 class with mutagen.mp3.MP3::
from mutagen.mp3 import EasyMP3 as MP3
MP3(filename)
Because many of the attributes are constructed on the fly, things
like the following will not work::
ezid3["performer"].append("Joe")
Instead, you must do::
values = ezid3["performer"]
values.append("Joe")
ezid3["performer"] = values
"""
Set = {}
Get = {}
Delete = {}
List = {}
# For compatibility.
valid_keys = Get
GetFallback = None
SetFallback = None
DeleteFallback = None
ListFallback = None
@classmethod
def RegisterKey(cls, key,
getter=None, setter=None, deleter=None, lister=None):
"""Register a new key mapping.
A key mapping is four functions, a getter, setter, deleter,
and lister. The key may be either a string or a glob pattern.
The getter, deleted, and lister receive an ID3 instance and
the requested key name. The setter also receives the desired
value, which will be a list of strings.
The getter, setter, and deleter are used to implement __getitem__,
__setitem__, and __delitem__.
The lister is used to implement keys(). It should return a
list of keys that are actually in the ID3 instance, provided
by its associated getter.
"""
key = key.lower()
if getter is not None:
cls.Get[key] = getter
if setter is not None:
cls.Set[key] = setter
if deleter is not None:
cls.Delete[key] = deleter
if lister is not None:
cls.List[key] = lister
@classmethod
def RegisterTextKey(cls, key, frameid):
"""Register a text key.
If the key you need to register is a simple one-to-one mapping
of ID3 frame name to EasyID3 key, then you can use this
function::
EasyID3.RegisterTextKey("title", "TIT2")
"""
def getter(id3, key):
return list(id3[frameid])
def setter(id3, key, value):
try:
frame = id3[frameid]
except KeyError:
id3.add(mutagen.id3.Frames[frameid](encoding=3, text=value))
else:
frame.encoding = 3
frame.text = value
def deleter(id3, key):
del(id3[frameid])
cls.RegisterKey(key, getter, setter, deleter)
@classmethod
def RegisterTXXXKey(cls, key, desc):
"""Register a user-defined text frame key.
Some ID3 tags are stored in TXXX frames, which allow a
freeform 'description' which acts as a subkey,
e.g. TXXX:BARCODE.::
EasyID3.RegisterTXXXKey('barcode', 'BARCODE').
"""
frameid = "TXXX:" + desc
def getter(id3, key):
return list(id3[frameid])
def setter(id3, key, value):
try:
frame = id3[frameid]
except KeyError:
enc = 0
# Store 8859-1 if we can, per MusicBrainz spec.
try:
for v in value:
v.encode('latin_1')
except UnicodeError:
enc = 3
id3.add(mutagen.id3.TXXX(encoding=enc, text=value, desc=desc))
else:
frame.text = value
def deleter(id3, key):
del(id3[frameid])
cls.RegisterKey(key, getter, setter, deleter)
def __init__(self, filename=None):
self.__id3 = ID3()
if filename is not None:
self.load(filename)
load = property(lambda s: s.__id3.load,
lambda s, v: setattr(s.__id3, 'load', v))
save = property(lambda s: s.__id3.save,
lambda s, v: setattr(s.__id3, 'save', v))
delete = property(lambda s: s.__id3.delete,
lambda s, v: setattr(s.__id3, 'delete', v))
filename = property(lambda s: s.__id3.filename,
lambda s, fn: setattr(s.__id3, 'filename', fn))
size = property(lambda s: s.__id3.size,
lambda s, fn: setattr(s.__id3, 'size', s))
def __getitem__(self, key):
key = key.lower()
func = dict_match(self.Get, key, self.GetFallback)
if func is not None:
return func(self.__id3, key)
else:
raise EasyID3KeyError("%r is not a valid key" % key)
def __setitem__(self, key, value):
key = key.lower()
if PY2:
if isinstance(value, basestring):
value = [value]
else:
if isinstance(value, text_type):
value = [value]
func = dict_match(self.Set, key, self.SetFallback)
if func is not None:
return func(self.__id3, key, value)
else:
raise EasyID3KeyError("%r is not a valid key" % key)
def __delitem__(self, key):
key = key.lower()
func = dict_match(self.Delete, key, self.DeleteFallback)
if func is not None:
return func(self.__id3, key)
else:
raise EasyID3KeyError("%r is not a valid key" % key)
def __iter__(self):
keys = []
for key in self.Get.keys():
if key in self.List:
keys.extend(self.List[key](self.__id3, key))
elif key in self:
keys.append(key)
if self.ListFallback is not None:
keys.extend(self.ListFallback(self.__id3, ""))
return iter(keys)
def __len__(self):
keys = []
for key in self.Get.keys():
if key in self.List:
keys.extend(self.List[key](self.__id3, key))
elif key in self:
keys.append(key)
if self.ListFallback is not None:
keys.extend(self.ListFallback(self.__id3, ""))
return len(keys)
def pprint(self):
"""Print tag key=value pairs."""
strings = []
for key in sorted(self.keys()):
values = self[key]
for value in values:
strings.append("%s=%s" % (key, value))
return "\n".join(strings)
|
class EasyID3(MutableMapping, mutagen.Metadata):
'''A file with an ID3 tag.
Like Vorbis comments, EasyID3 keys are case-insensitive ASCII
strings. Only a subset of ID3 frames are supported by default. Use
EasyID3.RegisterKey and its wrappers to support more.
You can also set the GetFallback, SetFallback, and DeleteFallback
to generic key getter/setter/deleter functions, which are called
if no specific handler is registered for a key. Additionally,
ListFallback can be used to supply an arbitrary list of extra
keys. These can be set on EasyID3 or on individual instances after
creation.
To use an EasyID3 class with mutagen.mp3.MP3::
from mutagen.mp3 import EasyMP3 as MP3
MP3(filename)
Because many of the attributes are constructed on the fly, things
like the following will not work::
ezid3["performer"].append("Joe")
Instead, you must do::
values = ezid3["performer"]
values.append("Joe")
ezid3["performer"] = values
'''
@classmethod
def RegisterKey(cls, key,
getter=None, setter=None, deleter=None, lister=None):
'''Register a new key mapping.
A key mapping is four functions, a getter, setter, deleter,
and lister. The key may be either a string or a glob pattern.
The getter, deleted, and lister receive an ID3 instance and
the requested key name. The setter also receives the desired
value, which will be a list of strings.
The getter, setter, and deleter are used to implement __getitem__,
__setitem__, and __delitem__.
The lister is used to implement keys(). It should return a
list of keys that are actually in the ID3 instance, provided
by its associated getter.
'''
pass
@classmethod
def RegisterTextKey(cls, key, frameid):
'''Register a text key.
If the key you need to register is a simple one-to-one mapping
of ID3 frame name to EasyID3 key, then you can use this
function::
EasyID3.RegisterTextKey("title", "TIT2")
'''
pass
def getter(id3, key):
pass
def setter(id3, key, value):
pass
def deleter(id3, key):
pass
@classmethod
def RegisterTXXXKey(cls, key, desc):
'''Register a user-defined text frame key.
Some ID3 tags are stored in TXXX frames, which allow a
freeform 'description' which acts as a subkey,
e.g. TXXX:BARCODE.::
EasyID3.RegisterTXXXKey('barcode', 'BARCODE').
'''
pass
def getter(id3, key):
pass
def setter(id3, key, value):
pass
def deleter(id3, key):
pass
def __init__(self, filename=None):
pass
def __getitem__(self, key):
pass
def __setitem__(self, key, value):
pass
def __delitem__(self, key):
pass
def __iter__(self):
pass
def __len__(self):
pass
def pprint(self):
'''Print tag key=value pairs.'''
pass
| 20 | 5 | 11 | 1 | 8 | 2 | 3 | 0.38 | 2 | 6 | 3 | 0 | 7 | 1 | 10 | 14 | 217 | 43 | 126 | 52 | 105 | 48 | 111 | 48 | 94 | 5 | 2 | 3 | 41 |
147,164 |
LordSputnik/mutagen
|
LordSputnik_mutagen/mutagen/_util.py
|
mutagen._util.cdata
|
class cdata(object):
"""C character buffer to Python numeric type conversions."""
from struct import error
error = error
short_le = staticmethod(lambda data: struct.unpack('<h', data)[0])
ushort_le = staticmethod(lambda data: struct.unpack('<H', data)[0])
short_be = staticmethod(lambda data: struct.unpack('>h', data)[0])
ushort_be = staticmethod(lambda data: struct.unpack('>H', data)[0])
int_le = staticmethod(lambda data: struct.unpack('<i', data)[0])
uint_le = staticmethod(lambda data: struct.unpack('<I', data)[0])
int_be = staticmethod(lambda data: struct.unpack('>i', data)[0])
uint_be = staticmethod(lambda data: struct.unpack('>I', data)[0])
longlong_le = staticmethod(lambda data: struct.unpack('<q', data)[0])
ulonglong_le = staticmethod(lambda data: struct.unpack('<Q', data)[0])
longlong_be = staticmethod(lambda data: struct.unpack('>q', data)[0])
ulonglong_be = staticmethod(lambda data: struct.unpack('>Q', data)[0])
to_short_le = staticmethod(lambda data: struct.pack('<h', data))
to_ushort_le = staticmethod(lambda data: struct.pack('<H', data))
to_short_be = staticmethod(lambda data: struct.pack('>h', data))
to_ushort_be = staticmethod(lambda data: struct.pack('>H', data))
to_int_le = staticmethod(lambda data: struct.pack('<i', data))
to_uint_le = staticmethod(lambda data: struct.pack('<I', data))
to_int_be = staticmethod(lambda data: struct.pack('>i', data))
to_uint_be = staticmethod(lambda data: struct.pack('>I', data))
to_longlong_le = staticmethod(lambda data: struct.pack('<q', data))
to_ulonglong_le = staticmethod(lambda data: struct.pack('<Q', data))
to_longlong_be = staticmethod(lambda data: struct.pack('>q', data))
to_ulonglong_be = staticmethod(lambda data: struct.pack('>Q', data))
bitswap = b''.join(chr_(sum(((val >> i) & 1) << (7-i) for i in range(8)))
for val in range(256))
test_bit = staticmethod(lambda value, n: bool((value >> n) & 1))
|
class cdata(object):
'''C character buffer to Python numeric type conversions.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.03 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 46 | 15 | 30 | 29 | 28 | 1 | 29 | 29 | 27 | 0 | 1 | 0 | 0 |
147,165 |
LordSputnik/mutagen
|
LordSputnik_mutagen/mutagen/aiff.py
|
mutagen.aiff.IFFFile
|
class IFFFile(object):
"""Representation of a IFF file"""
def __init__(self, fileobj):
self.__fileobj = fileobj
self.__chunks = {}
# AIFF Files always start with the FORM chunk which contains a 4 byte
# ID before the start of other chunks
fileobj.seek(0)
self.__chunks[u'FORM'] = IFFChunk(fileobj)
# Skip past the 4 byte FORM id
fileobj.seek(IFFChunk.HEADER_SIZE + 4)
# Where the next chunk can be located. We need to keep track of this
# since the size indicated in the FORM header may not match up with the
# offset determined from the size of the last chunk in the file
self.__next_offset = fileobj.tell()
# Load all of the chunks
while True:
try:
chunk = IFFChunk(fileobj, self[u'FORM'])
except InvalidChunk:
break
self.__chunks[chunk.id.strip()] = chunk
# Calculate the location of the next chunk,
# considering the pad byte
self.__next_offset = chunk.offset + chunk.size
self.__next_offset += self.__next_offset % 2
fileobj.seek(self.__next_offset)
def __contains__(self, id_):
"""Check if the IFF file contains a specific chunk"""
if not isinstance(id_, text_type):
id_ = id_.decode('ascii')
if not is_valid_chunk_id(id_):
raise KeyError("AIFF key must be four ASCII characters.")
return id_ in self.__chunks
def __getitem__(self, id_):
"""Get a chunk from the IFF file"""
if not isinstance(id_, text_type):
id_ = id_.decode('ascii')
if not is_valid_chunk_id(id_):
raise KeyError("AIFF key must be four ASCII characters.")
try:
return self.__chunks[id_]
except KeyError:
raise KeyError(
"%r has no %r chunk" % (self.__fileobj.name, id_))
def __delitem__(self, id_):
"""Remove a chunk from the IFF file"""
if not isinstance(id_, text_type):
id_ = id_.decode('ascii')
if not is_valid_chunk_id(id_):
raise KeyError("AIFF key must be four ASCII characters.")
self.__chunks.pop(id_).delete()
def insert_chunk(self, id_):
"""Insert a new chunk at the end of the IFF file"""
if not isinstance(id_, text_type):
id_ = id_.decode('ascii')
if not is_valid_chunk_id(id_):
raise KeyError("AIFF key must be four ASCII characters.")
self.__fileobj.seek(self.__next_offset)
self.__fileobj.write(pack('>4si', id_.ljust(4).encode('ascii'), 0))
self.__fileobj.seek(self.__next_offset)
chunk = IFFChunk(self.__fileobj, self[u'FORM'])
self[u'FORM'].resize(self[u'FORM'].data_size + chunk.size)
self.__chunks[id_] = chunk
self.__next_offset = chunk.offset + chunk.size
|
class IFFFile(object):
'''Representation of a IFF file'''
def __init__(self, fileobj):
pass
def __contains__(self, id_):
'''Check if the IFF file contains a specific chunk'''
pass
def __getitem__(self, id_):
'''Get a chunk from the IFF file'''
pass
def __delitem__(self, id_):
'''Remove a chunk from the IFF file'''
pass
def insert_chunk(self, id_):
'''Insert a new chunk at the end of the IFF file'''
pass
| 6 | 5 | 16 | 4 | 10 | 3 | 3 | 0.27 | 1 | 3 | 2 | 0 | 5 | 3 | 5 | 5 | 88 | 23 | 51 | 11 | 45 | 14 | 50 | 11 | 44 | 4 | 1 | 2 | 16 |
147,166 |
LordSputnik/mutagen
|
LordSputnik_mutagen/tests/test_wavpack.py
|
tests.test_wavpack.TWavPack
|
class TWavPack(TestCase):
def setUp(self):
self.audio = WavPack(os.path.join("tests", "data", "silence-44-s.wv"))
def test_version(self):
self.failUnlessEqual(self.audio.info.version, 0x403)
def test_channels(self):
self.failUnlessEqual(self.audio.info.channels, 2)
def test_sample_rate(self):
self.failUnlessEqual(self.audio.info.sample_rate, 44100)
def test_length(self):
self.failUnlessAlmostEqual(self.audio.info.length, 3.68, 2)
def test_not_my_file(self):
self.failUnlessRaises(
IOError, WavPack, os.path.join("tests", "data", "empty.ogg"))
def test_pprint(self):
self.audio.pprint()
def test_mime(self):
self.failUnless("audio/x-wavpack" in self.audio.mime)
|
class TWavPack(TestCase):
def setUp(self):
pass
def test_version(self):
pass
def test_channels(self):
pass
def test_sample_rate(self):
pass
def test_length(self):
pass
def test_not_my_file(self):
pass
def test_pprint(self):
pass
def test_mime(self):
pass
| 9 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 1 | 1 | 1 | 0 | 8 | 1 | 8 | 83 | 26 | 8 | 18 | 10 | 9 | 0 | 17 | 10 | 8 | 1 | 3 | 0 | 8 |
147,167 |
LordSputnik/mutagen
|
LordSputnik_mutagen/tests/test_wavpack.py
|
tests.test_wavpack.TWavPackNoLength
|
class TWavPackNoLength(TestCase):
def setUp(self):
self.audio = WavPack(os.path.join("tests", "data", "no_length.wv"))
def test_version(self):
self.failUnlessEqual(self.audio.info.version, 0x407)
def test_channels(self):
self.failUnlessEqual(self.audio.info.channels, 2)
def test_sample_rate(self):
self.failUnlessEqual(self.audio.info.sample_rate, 44100)
def test_length(self):
self.failUnlessAlmostEqual(self.audio.info.length, 3.705, 3)
def test_pprint(self):
self.audio.pprint()
def test_mime(self):
self.failUnless("audio/x-wavpack" in self.audio.mime)
|
class TWavPackNoLength(TestCase):
def setUp(self):
pass
def test_version(self):
pass
def test_channels(self):
pass
def test_sample_rate(self):
pass
def test_length(self):
pass
def test_pprint(self):
pass
def test_mime(self):
pass
| 8 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 1 | 1 | 1 | 0 | 7 | 1 | 7 | 82 | 22 | 7 | 15 | 9 | 7 | 0 | 15 | 9 | 7 | 1 | 3 | 0 | 7 |
147,168 |
LordSputnik/mutagen
|
LordSputnik_mutagen/mutagen/apev2.py
|
mutagen.apev2.APENoHeaderError
|
class APENoHeaderError(error, ValueError):
pass
|
class APENoHeaderError(error, ValueError):
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 11 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 4 | 0 | 0 |
147,169 |
LordSputnik/mutagen
|
LordSputnik_mutagen/mutagen/apev2.py
|
mutagen.apev2.APEExtValue
|
class APEExtValue(_APEUtf8Value):
"""An APEv2 external value.
External values are usually URI or IRI strings.
"""
def pprint(self):
return u"[External] %s" % text_type(self)
|
class APEExtValue(_APEUtf8Value):
'''An APEv2 external value.
External values are usually URI or IRI strings.
'''
def pprint(self):
pass
| 2 | 1 | 2 | 0 | 2 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 11 | 8 | 2 | 3 | 2 | 1 | 3 | 3 | 2 | 1 | 1 | 3 | 0 | 1 |
147,170 |
LordSputnik/mutagen
|
LordSputnik_mutagen/mutagen/_vorbis.py
|
mutagen._vorbis.VComment
|
class VComment(mutagen.Metadata, MutableSequence):
"""A Vorbis comment parser, accessor, and renderer.
All comment ordering is preserved. A VComment is a list of
key/value pairs, and so any Python list method can be used on it.
Vorbis comments are always wrapped in something like an Ogg Vorbis
bitstream or a FLAC metadata block, so this loads string data or a
file-like object, not a filename.
Attributes:
* vendor -- the stream 'vendor' (i.e. writer); default 'Mutagen'
"""
vendor = u"Mutagen " + mutagen.version_string
def __init__(self, data=None, *args, **kwargs):
# Collect the args to pass to load, this lets child classes
# override just load and get equivalent magic for the
# constructor.
self._internal = []
if data is not None:
if isinstance(data, bytes):
data = BytesIO(data)
elif not hasattr(data, 'read'):
raise TypeError("VComment requires bytes or a file-like")
self.load(data, *args, **kwargs)
def __getitem__(self, index):
return self._internal[index]
def __setitem__(self, index, value):
self._internal[index] = value
def __delitem__(self, index):
del self._internal[index]
def __len__(self):
return len(self._internal)
def insert(self, index, value):
self._internal.insert(index, value)
def load(self, fileobj, errors='replace', framing=True):
"""Parse a Vorbis comment from a file-like object.
Keyword arguments:
* errors:
'strict', 'replace', or 'ignore'. This affects Unicode decoding
and how other malformed content is interpreted.
* framing -- if true, fail if a framing bit is not present
Framing bits are required by the Vorbis comment specification,
but are not used in FLAC Vorbis comment blocks.
"""
try:
vendor_length = cdata.uint_le(fileobj.read(4))
self.vendor = fileobj.read(vendor_length).decode('utf-8', errors)
count = cdata.uint_le(fileobj.read(4))
for i in xrange(count):
length = cdata.uint_le(fileobj.read(4))
try:
string = fileobj.read(length).decode('utf-8', errors)
except (OverflowError, MemoryError):
raise error("cannot read %d bytes, too large" % length)
try:
tag, value = string.split('=', 1)
except ValueError as err:
if errors == "ignore":
continue
elif errors == "replace":
tag, value = u"unknown%d" % i, string
else:
reraise(VorbisEncodingError, err, sys.exc_info()[2])
try:
tag = tag.encode('ascii', errors)
except UnicodeEncodeError:
raise VorbisEncodingError("invalid tag name %r" % tag)
else:
# string keys in py3k
if PY3:
tag = tag.decode("ascii")
if is_valid_key(tag):
self.append((tag, value))
if framing and not bytearray(fileobj.read(1))[0] & 0x01:
raise VorbisUnsetFrameError("framing bit was unset")
except (cdata.error, TypeError):
raise error("file is not a valid Vorbis comment")
def validate(self):
"""Validate keys and values.
Check to make sure every key used is a valid Vorbis key, and
that every value used is a valid Unicode or UTF-8 string. If
any invalid keys or values are found, a ValueError is raised.
In Python 3 all keys and values have to be a string.
"""
# be stricter in Python 3
if PY3:
if not isinstance(self.vendor, text_type):
raise ValueError
for key, value in self:
if not isinstance(key, text_type):
raise ValueError
if not isinstance(value, text_type):
raise ValueError
if not isinstance(self.vendor, text_type):
try:
self.vendor.decode('utf-8')
except UnicodeDecodeError:
raise ValueError
for key, value in self._internal:
try:
if not is_valid_key(key):
raise ValueError
except:
raise ValueError("%r is not a valid key" % key)
if not isinstance(value, text_type):
try:
value.decode("utf-8")
except:
raise ValueError("%r is not a valid value" % value)
else:
return True
def clear(self):
"""Clear all keys from the comment."""
for i in list(self._internal):
self._internal.remove(i)
def write(self, framing=True):
"""Return a string representation of the data.
Validation is always performed, so calling this function on
invalid data may raise a ValueError.
Keyword arguments:
* framing -- if true, append a framing bit (see load)
"""
self.validate()
def _encode(value):
if not isinstance(value, bytes):
return value.encode('utf-8')
return value
f = BytesIO()
vendor = _encode(self.vendor)
f.write(cdata.to_uint_le(len(vendor)))
f.write(vendor)
f.write(cdata.to_uint_le(len(self)))
for tag, value in self._internal:
tag = _encode(tag)
value = _encode(value)
comment = tag + b"=" + value
f.write(cdata.to_uint_le(len(comment)))
f.write(comment)
if framing:
f.write(b"\x01")
return f.getvalue()
def pprint(self):
def _decode(value):
if not isinstance(value, text_type):
return value.decode('utf-8', 'replace')
return value
tags = [u"%s=%s" % (_decode(k), _decode(v)) for k, v in self._internal]
return u"\n".join(tags)
def __eq__(self, other):
if isinstance(other, VComment):
return self._internal == other._internal
else:
return self._internal == other
def __ne__(self, other):
return not self.__eq__(other)
|
class VComment(mutagen.Metadata, MutableSequence):
'''A Vorbis comment parser, accessor, and renderer.
All comment ordering is preserved. A VComment is a list of
key/value pairs, and so any Python list method can be used on it.
Vorbis comments are always wrapped in something like an Ogg Vorbis
bitstream or a FLAC metadata block, so this loads string data or a
file-like object, not a filename.
Attributes:
* vendor -- the stream 'vendor' (i.e. writer); default 'Mutagen'
'''
def __init__(self, data=None, *args, **kwargs):
pass
def __getitem__(self, index):
pass
def __setitem__(self, index, value):
pass
def __delitem__(self, index):
pass
def __len__(self):
pass
def insert(self, index, value):
pass
def load(self, fileobj, errors='replace', framing=True):
'''Parse a Vorbis comment from a file-like object.
Keyword arguments:
* errors:
'strict', 'replace', or 'ignore'. This affects Unicode decoding
and how other malformed content is interpreted.
* framing -- if true, fail if a framing bit is not present
Framing bits are required by the Vorbis comment specification,
but are not used in FLAC Vorbis comment blocks.
'''
pass
def validate(self):
'''Validate keys and values.
Check to make sure every key used is a valid Vorbis key, and
that every value used is a valid Unicode or UTF-8 string. If
any invalid keys or values are found, a ValueError is raised.
In Python 3 all keys and values have to be a string.
'''
pass
def clear(self):
'''Clear all keys from the comment.'''
pass
def write(self, framing=True):
'''Return a string representation of the data.
Validation is always performed, so calling this function on
invalid data may raise a ValueError.
Keyword arguments:
* framing -- if true, append a framing bit (see load)
'''
pass
def _encode(value):
pass
def pprint(self):
pass
def _decode(value):
pass
def __eq__(self, other):
pass
def __ne__(self, other):
pass
| 16 | 5 | 11 | 1 | 8 | 2 | 3 | 0.31 | 2 | 13 | 4 | 0 | 13 | 1 | 13 | 17 | 192 | 39 | 117 | 32 | 101 | 36 | 113 | 31 | 97 | 13 | 2 | 4 | 46 |
147,171 |
LordSputnik/mutagen
|
LordSputnik_mutagen/mutagen/mp3.py
|
mutagen.mp3.MPEGInfo
|
class MPEGInfo(StreamInfo):
"""MPEG audio stream information
Parse information about an MPEG audio file. This also reads the
Xing VBR header format.
This code was implemented based on the format documentation at
http://mpgedit.org/mpgedit/mpeg_format/mpeghdr.htm.
Useful attributes:
* length -- audio length, in seconds
* bitrate -- audio bitrate, in bits per second
* sketchy -- if true, the file may not be valid MPEG audio
Useless attributes:
* version -- MPEG version (1, 2, 2.5)
* layer -- 1, 2, or 3
* mode -- One of STEREO, JOINTSTEREO, DUALCHANNEL, or MONO (0-3)
* protected -- whether or not the file is "protected"
* padding -- whether or not audio frames are padded
* sample_rate -- audio sample rate, in Hz
"""
# Map (version, layer) tuples to bitrates.
__BITRATE = {
(1, 1): [0, 32, 64, 96,128,160,192,224,256,288,320,352,384,416,448],
(1, 2): [0, 32, 48, 56, 64, 80, 96,112,128,160,192,224,256,320,384],
(1, 3): [0, 32, 40, 48, 56, 64, 80, 96,112,128,160,192,224,256,320],
(2, 1): [0, 32, 48, 56, 64, 80, 96,112,128,144,160,176,192,224,256],
(2, 2): [0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96,112,128,144,160],
}
__BITRATE[(2, 3)] = __BITRATE[(2, 2)]
for i in range(1, 4):
__BITRATE[(2.5, i)] = __BITRATE[(2, i)]
# Map version to sample rates.
__RATES = {
1: [44100, 48000, 32000],
2: [22050, 24000, 16000],
2.5: [11025, 12000, 8000]
}
sketchy = False
def __init__(self, fileobj, offset=None):
"""Parse MPEG stream information from a file-like object.
If an offset argument is given, it is used to start looking
for stream information and Xing headers; otherwise, ID3v2 tags
will be skipped automatically. A correct offset can make
loading files significantly faster.
"""
try:
size = os.path.getsize(fileobj.name)
except (IOError, OSError, AttributeError):
fileobj.seek(0, 2)
size = fileobj.tell()
# If we don't get an offset, try to skip an ID3v2 tag.
if offset is None:
fileobj.seek(0, 0)
idata = fileobj.read(10)
try:
id3, insize = struct.unpack('>3sxxx4s', idata)
except struct.error:
id3, insize = '', 0
insize = BitPaddedInt(insize)
if id3 == b'ID3' and insize > 0:
offset = insize + 10
else:
offset = 0
# Try to find two valid headers (meaning, very likely MPEG data)
# at the given offset, 30% through the file, 60% through the file,
# and 90% through the file.
for i in [offset, 0.3 * size, 0.6 * size, 0.9 * size]:
try:
self.__try(fileobj, int(i), size - offset)
except error:
pass
else:
break
# If we can't find any two consecutive frames, try to find just
# one frame back at the original offset given.
else:
self.__try(fileobj, offset, size - offset, False)
self.sketchy = True
def __try(self, fileobj, offset, real_size, check_second=True):
# This is going to be one really long function; bear with it,
# because there's not really a sane point to cut it up.
fileobj.seek(offset, 0)
# We "know" we have an MPEG file if we find two frames that look like
# valid MPEG data. If we can't find them in 32k of reads, something
# is horribly wrong (the longest frame can only be about 4k). This
# is assuming the offset didn't lie.
data = fileobj.read(32768)
frame_1 = data.find(b"\xff")
while 0 <= frame_1 <= (len(data) - 4):
frame_data = struct.unpack(">I", data[frame_1:frame_1 + 4])[0]
if ((frame_data >> 16) & 0xE0) != 0xE0:
frame_1 = data.find(b"\xff", frame_1 + 2)
else:
version = (frame_data >> 19) & 0x3
layer = (frame_data >> 17) & 0x3
protection = (frame_data >> 16) & 0x1
bitrate = (frame_data >> 12) & 0xF
sample_rate = (frame_data >> 10) & 0x3
padding = (frame_data >> 9) & 0x1
#private = (frame_data >> 8) & 0x1
self.mode = (frame_data >> 6) & 0x3
#mode_extension = (frame_data >> 4) & 0x3
#copyright = (frame_data >> 3) & 0x1
#original = (frame_data >> 2) & 0x1
#emphasis = (frame_data >> 0) & 0x3
if (version == 1 or layer == 0 or sample_rate == 0x3 or
bitrate == 0 or bitrate == 0xF):
frame_1 = data.find(b"\xff", frame_1 + 2)
else:
break
else:
raise HeaderNotFoundError("can't sync to an MPEG frame")
# There is a serious problem here, which is that many flags
# in an MPEG header are backwards.
self.version = [2.5, None, 2, 1][version]
self.layer = 4 - layer
self.protected = not protection
self.padding = bool(padding)
self.bitrate = self.__BITRATE[(self.version, self.layer)][bitrate]
self.bitrate *= 1000
self.sample_rate = self.__RATES[self.version][sample_rate]
if self.layer == 1:
frame_length = ((12 * self.bitrate // self.sample_rate) + padding) * 4
frame_size = 384
elif self.version >= 2 and self.layer == 3:
frame_length = (72 * self.bitrate // self.sample_rate) + padding
frame_size = 576
else:
frame_length = (144 * self.bitrate // self.sample_rate) + padding
frame_size = 1152
if check_second:
possible = int(frame_1 + frame_length)
if possible > len(data) + 4:
raise HeaderNotFoundError("can't sync to second MPEG frame")
try:
frame_data = struct.unpack(
">H", data[possible:possible + 2])[0]
except struct.error:
raise HeaderNotFoundError("can't sync to second MPEG frame")
if (frame_data & 0xFFE0) != 0xFFE0:
raise HeaderNotFoundError("can't sync to second MPEG frame")
self.length = 8 * real_size / float(self.bitrate)
# Try to find/parse the Xing header, which trumps the above length
# and bitrate calculation.
fileobj.seek(offset, 0)
data = fileobj.read(32768)
try:
xing = data[:-4].index(b"Xing")
except ValueError:
# Try to find/parse the VBRI header, which trumps the above length
# calculation.
try:
vbri = data[:-24].index(b"VBRI")
except ValueError:
pass
else:
# If a VBRI header was found, this is definitely MPEG audio.
self.sketchy = False
vbri_version = struct.unpack('>H', data[vbri + 4:vbri + 6])[0]
if vbri_version == 1:
frame_count = struct.unpack(
'>I', data[vbri + 14:vbri + 18])[0]
samples = float(frame_size * frame_count)
self.length = (samples / self.sample_rate) or self.length
else:
# If a Xing header was found, this is definitely MPEG audio.
self.sketchy = False
flags = struct.unpack('>I', data[xing + 4:xing + 8])[0]
if flags & 0x1:
frame_count = struct.unpack('>I', data[xing + 8:xing + 12])[0]
samples = float(frame_size * frame_count)
self.length = (samples / self.sample_rate) or self.length
if flags & 0x2:
bitrate_data = struct.unpack('>I', data[xing + 12:xing + 16])[0]
self.bitrate = int((bitrate_data * 8) // self.length)
def pprint(self):
s = "MPEG %s layer %d, %d bps, %s Hz, %.2f seconds" % (
self.version, self.layer, self.bitrate, self.sample_rate,
self.length)
if self.sketchy:
s += " (sketchy)"
return s
|
class MPEGInfo(StreamInfo):
'''MPEG audio stream information
Parse information about an MPEG audio file. This also reads the
Xing VBR header format.
This code was implemented based on the format documentation at
http://mpgedit.org/mpgedit/mpeg_format/mpeghdr.htm.
Useful attributes:
* length -- audio length, in seconds
* bitrate -- audio bitrate, in bits per second
* sketchy -- if true, the file may not be valid MPEG audio
Useless attributes:
* version -- MPEG version (1, 2, 2.5)
* layer -- 1, 2, or 3
* mode -- One of STEREO, JOINTSTEREO, DUALCHANNEL, or MONO (0-3)
* protected -- whether or not the file is "protected"
* padding -- whether or not audio frames are padded
* sample_rate -- audio sample rate, in Hz
'''
def __init__(self, fileobj, offset=None):
'''Parse MPEG stream information from a file-like object.
If an offset argument is given, it is used to start looking
for stream information and Xing headers; otherwise, ID3v2 tags
will be skipped automatically. A correct offset can make
loading files significantly faster.
'''
pass
def __try(self, fileobj, offset, real_size, check_second=True):
pass
def pprint(self):
pass
| 4 | 2 | 52 | 4 | 38 | 10 | 8 | 0.38 | 1 | 9 | 3 | 0 | 3 | 8 | 3 | 4 | 205 | 25 | 130 | 40 | 126 | 50 | 110 | 40 | 106 | 15 | 2 | 3 | 24 |
147,172 |
LordSputnik/mutagen
|
LordSputnik_mutagen/mutagen/mp3.py
|
mutagen.mp3.MP3
|
class MP3(ID3FileType):
"""An MPEG audio (usually MPEG-1 Layer 3) file.
:ivar info: :class:`MPEGInfo`
:ivar tags: :class:`ID3 <mutagen.id3.ID3>`
"""
_Info = MPEGInfo
_mimes = ["audio/mpeg", "audio/mpg", "audio/x-mpeg"]
@property
def mime(self):
l = self.info.layer
return ["audio/mp%d" % l, "audio/x-mp%d" % l] + super(MP3, self).mime
@staticmethod
def score(filename, fileobj, header_data):
if isinstance(filename, bytes):
filename = filename.decode('utf-8')
filename = filename.lower()
return (header_data.startswith(b"ID3") * 2 + endswith(filename, b".mp3") +
endswith(filename, b".mp2") + endswith(filename, b".mpg") +
endswith(filename, b".mpeg"))
|
class MP3(ID3FileType):
'''An MPEG audio (usually MPEG-1 Layer 3) file.
:ivar info: :class:`MPEGInfo`
:ivar tags: :class:`ID3 <mutagen.id3.ID3>`
'''
@property
def mime(self):
pass
@staticmethod
def score(filename, fileobj, header_data):
pass
| 5 | 1 | 6 | 1 | 5 | 0 | 2 | 0.27 | 1 | 2 | 0 | 1 | 1 | 0 | 2 | 18 | 26 | 7 | 15 | 8 | 10 | 4 | 11 | 6 | 8 | 2 | 3 | 1 | 3 |
147,173 |
LordSputnik/mutagen
|
LordSputnik_mutagen/mutagen/aiff.py
|
mutagen.aiff.IFFChunk
|
class IFFChunk(object):
"""Representation of a single IFF chunk"""
# Chunk headers are 8 bytes long (4 for ID and 4 for the size)
HEADER_SIZE = 8
def __init__(self, fileobj, parent_chunk=None):
self.__fileobj = fileobj
self.parent_chunk = parent_chunk
self.offset = fileobj.tell()
header = fileobj.read(self.HEADER_SIZE)
if len(header) < self.HEADER_SIZE:
raise InvalidChunk()
self.id, self.data_size = struct.unpack('>4si', header)
if not isinstance(self.id, text_type):
self.id = self.id.decode('ascii')
if not is_valid_chunk_id(self.id):
raise InvalidChunk()
self.size = self.HEADER_SIZE + self.data_size
self.data_offset = fileobj.tell()
self.data = None
def read(self):
"""Read the chunks data"""
self.__fileobj.seek(self.data_offset)
self.data = self.__fileobj.read(self.data_size)
def delete(self):
"""Removes the chunk from the file"""
delete_bytes(self.__fileobj, self.size, self.offset)
if self.parent_chunk is not None:
self.parent_chunk.resize(self.parent_chunk.data_size - self.size)
def resize(self, data_size):
"""Update the size of the chunk"""
self.__fileobj.seek(self.offset + 4)
self.__fileobj.write(pack('>I', data_size))
if self.parent_chunk is not None:
size_diff = self.data_size - data_size
self.parent_chunk.resize(self.parent_chunk.data_size - size_diff)
self.data_size = data_size
self.size = data_size + self.HEADER_SIZE
|
class IFFChunk(object):
'''Representation of a single IFF chunk'''
def __init__(self, fileobj, parent_chunk=None):
pass
def read(self):
'''Read the chunks data'''
pass
def delete(self):
'''Removes the chunk from the file'''
pass
def resize(self, data_size):
'''Update the size of the chunk'''
pass
| 5 | 4 | 10 | 1 | 8 | 1 | 2 | 0.16 | 1 | 1 | 1 | 0 | 4 | 8 | 4 | 4 | 47 | 10 | 32 | 15 | 27 | 5 | 32 | 15 | 27 | 4 | 1 | 1 | 9 |
147,174 |
LordSputnik/mutagen
|
LordSputnik_mutagen/mutagen/apev2.py
|
mutagen.apev2.APEBinaryValue
|
class APEBinaryValue(_APEValue):
"""An APEv2 binary value."""
def pprint(self):
return u"[%d bytes]" % len(self)
|
class APEBinaryValue(_APEValue):
'''An APEv2 binary value.'''
def pprint(self):
pass
| 2 | 1 | 2 | 0 | 2 | 0 | 1 | 0.33 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 8 | 5 | 1 | 3 | 2 | 1 | 1 | 3 | 2 | 1 | 1 | 2 | 0 | 1 |
147,175 |
LordSputnik/mutagen
|
LordSputnik_mutagen/mutagen/aiff.py
|
mutagen.aiff.AIFFInfo
|
class AIFFInfo(StreamInfo):
"""AIFF audio stream information.
Information is parsed from the COMM chunk of the AIFF file
Useful attributes:
* length -- audio length, in seconds
* bitrate -- audio bitrate, in bits per second
* channels -- The number of audio channels
* sample_rate -- audio sample rate, in Hz
* sample_size -- The audio sample size
"""
length = 0
bitrate = 0
channels = 0
sample_rate = 0
def __init__(self, fileobj):
iff = IFFFile(fileobj)
try:
common_chunk = iff[u'COMM']
except KeyError as e:
raise error(str(e))
common_chunk.read()
info = struct.unpack('>hLh10s', common_chunk.data[:18])
channels, frame_count, sample_size, sample_rate = info
self.sample_rate = int(read_float(sample_rate))
self.sample_size = sample_size
self.channels = channels
self.bitrate = channels * sample_size * self.sample_rate
self.length = frame_count / float(self.sample_rate)
def pprint(self):
return "%d channel AIFF @ %d bps, %s Hz, %.2f seconds" % (
self.channels, self.bitrate, self.sample_rate, self.length)
|
class AIFFInfo(StreamInfo):
'''AIFF audio stream information.
Information is parsed from the COMM chunk of the AIFF file
Useful attributes:
* length -- audio length, in seconds
* bitrate -- audio bitrate, in bits per second
* channels -- The number of audio channels
* sample_rate -- audio sample rate, in Hz
* sample_size -- The audio sample size
'''
def __init__(self, fileobj):
pass
def pprint(self):
pass
| 3 | 1 | 10 | 2 | 9 | 0 | 2 | 0.41 | 1 | 6 | 2 | 0 | 2 | 1 | 2 | 3 | 40 | 9 | 22 | 13 | 19 | 9 | 21 | 12 | 18 | 2 | 2 | 1 | 3 |
147,176 |
LordSputnik/mutagen
|
LordSputnik_mutagen/mutagen/aiff.py
|
mutagen.aiff._IFFID3
|
class _IFFID3(ID3):
"""A AIFF file with ID3v2 tags"""
def _load_header(self):
try:
self._fileobj.seek(IFFFile(self._fileobj)[u'ID3'].data_offset)
except (InvalidChunk, KeyError):
raise ID3Error()
super(_IFFID3, self)._load_header()
def save(self, filename=None, v2_version=4, v23_sep='/'):
"""Save ID3v2 data to the AIFF file"""
framedata = self._prepare_framedata(v2_version, v23_sep)
framesize = len(framedata)
if filename is None:
filename = self.filename
# Unlike the parent ID3.save method, we won't save to a blank file
# since we would have to construct a empty AIFF file
fileobj = open(filename, 'rb+')
iff_file = IFFFile(fileobj)
try:
if u'ID3' not in iff_file:
iff_file.insert_chunk(u'ID3')
chunk = iff_file[u'ID3']
fileobj.seek(chunk.data_offset)
header = fileobj.read(10)
header = self._prepare_id3_header(header, framesize, v2_version)
header, new_size, _ = header
data = header + framedata + (b'\x00' * (new_size - framesize))
# Include ID3 header size in 'new_size' calculation
new_size += 10
# Expand the chunk if necessary, including pad byte
if new_size > chunk.size:
insert_at = chunk.offset + chunk.size
insert_size = new_size - chunk.size + new_size % 2
insert_bytes(fileobj, insert_size, insert_at)
chunk.resize(new_size)
fileobj.seek(chunk.data_offset)
fileobj.write(data)
finally:
fileobj.close()
def delete(self, filename=None):
"""Completely removes the ID3 chunk from the AIFF file"""
if filename is None:
filename = self.filename
delete(filename)
self.clear()
|
class _IFFID3(ID3):
'''A AIFF file with ID3v2 tags'''
def _load_header(self):
pass
def save(self, filename=None, v2_version=4, v23_sep='/'):
'''Save ID3v2 data to the AIFF file'''
pass
def delete(self, filename=None):
'''Completely removes the ID3 chunk from the AIFF file'''
pass
| 4 | 3 | 18 | 4 | 12 | 2 | 3 | 0.18 | 1 | 4 | 2 | 0 | 3 | 0 | 3 | 34 | 59 | 14 | 38 | 14 | 34 | 7 | 37 | 14 | 33 | 4 | 3 | 2 | 8 |
147,177 |
LordSputnik/mutagen
|
LordSputnik_mutagen/mutagen/apev2.py
|
mutagen.apev2.APETextValue
|
class APETextValue(_APEUtf8Value):
"""An APEv2 text value.
Text values are Unicode/UTF-8 strings. They can be accessed like
strings (with a null separating the values), or arrays of strings.
"""
def __iter__(self):
"""Iterate over the strings of the value (not the characters)"""
return iter(text_type(self).split(u"\0"))
def __getitem__(self, index):
return text_type(self).split(u"\0")[index]
def __len__(self):
return self.value.count(b"\0") + 1
__hash__ = _APEValue.__hash__
def __setitem__(self, index, value):
if not isinstance(value, text_type):
if PY3:
raise TypeError("value not str")
value = value.decode("utf-8")
values = list(self)
values[index] = value
self.value = (u"\0".join(values)).encode('utf-8')
def pprint(self):
return u" / ".join(self)
|
class APETextValue(_APEUtf8Value):
'''An APEv2 text value.
Text values are Unicode/UTF-8 strings. They can be accessed like
strings (with a null separating the values), or arrays of strings.
'''
def __iter__(self):
'''Iterate over the strings of the value (not the characters)'''
pass
def __getitem__(self, index):
pass
def __len__(self):
pass
def __setitem__(self, index, value):
pass
def pprint(self):
pass
| 6 | 2 | 4 | 0 | 3 | 0 | 1 | 0.28 | 1 | 2 | 0 | 0 | 5 | 1 | 5 | 15 | 32 | 9 | 18 | 9 | 12 | 5 | 18 | 9 | 12 | 3 | 3 | 2 | 7 |
147,178 |
LordSputnik/mutagen
|
LordSputnik_mutagen/mutagen/apev2.py
|
mutagen.apev2.APEBadItemError
|
class APEBadItemError(error, ValueError):
pass
|
class APEBadItemError(error, ValueError):
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 11 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 4 | 0 | 0 |
147,179 |
LordSputnik/mutagen
|
LordSputnik_mutagen/mutagen/_util.py
|
mutagen._util.DictProxy
|
class DictProxy(MutableMapping):
def __init__(self, *args, **kwargs):
#Needs to be an ordered dict to get around a testing issue in EasyID3
self.__dict = OrderedDict()
super(DictProxy, self).__init__(*args, **kwargs)
def __getitem__(self, key):
return self.__dict[key]
def __setitem__(self, key, value):
self.__dict[key] = value
def __delitem__(self, key):
del(self.__dict[key])
def __iter__(self):
return iter(self.__dict)
def __len__(self):
return len(self.__dict)
|
class DictProxy(MutableMapping):
def __init__(self, *args, **kwargs):
pass
def __getitem__(self, key):
pass
def __setitem__(self, key, value):
pass
def __delitem__(self, key):
pass
def __iter__(self):
pass
def __len__(self):
pass
| 7 | 0 | 2 | 0 | 2 | 0 | 1 | 0.07 | 1 | 2 | 0 | 2 | 6 | 1 | 6 | 6 | 20 | 5 | 14 | 8 | 7 | 1 | 14 | 8 | 7 | 1 | 1 | 0 | 6 |
147,180 |
LordSputnik/mutagen
|
LordSputnik_mutagen/mutagen/aiff.py
|
mutagen.aiff.AIFF
|
class AIFF(FileType):
"""An AIFF audio file.
:ivar info: :class:`AIFFInfo`
:ivar tags: :class:`ID3`
"""
_mimes = ["audio/aiff", "audio/x-aiff"]
@staticmethod
def score(filename, fileobj, header):
filename = filename.lower()
return (header.startswith(b"FORM") * 2 + endswith(filename, b".aif") +
endswith(filename, b".aiff") + endswith(filename, b".aifc"))
def add_tags(self):
"""Add an empty ID3 tag to the file."""
if self.tags is None:
self.tags = _IFFID3()
else:
raise error("an ID3 tag already exists")
def load(self, filename, **kwargs):
"""Load stream and tag information from a file."""
self.filename = filename
try:
self.tags = _IFFID3(filename, **kwargs)
except ID3Error:
self.tags = None
try:
fileobj = open(filename, "rb")
self.info = AIFFInfo(fileobj)
finally:
fileobj.close()
|
class AIFF(FileType):
'''An AIFF audio file.
:ivar info: :class:`AIFFInfo`
:ivar tags: :class:`ID3`
'''
@staticmethod
def score(filename, fileobj, header):
pass
def add_tags(self):
'''Add an empty ID3 tag to the file.'''
pass
def load(self, filename, **kwargs):
'''Load stream and tag information from a file.'''
pass
| 5 | 3 | 8 | 1 | 7 | 1 | 2 | 0.26 | 1 | 3 | 3 | 0 | 2 | 3 | 3 | 16 | 37 | 8 | 23 | 10 | 18 | 6 | 19 | 9 | 15 | 2 | 2 | 1 | 5 |
147,181 |
LordSputnik/mutagen
|
LordSputnik_mutagen/mutagen/aiff.py
|
mutagen.aiff.InvalidChunk
|
class InvalidChunk(error, IOError):
pass
|
class InvalidChunk(error, IOError):
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 11 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 5 | 0 | 0 |
147,182 |
LordSputnik/mutagen
|
LordSputnik_mutagen/mutagen/_vorbis.py
|
mutagen._vorbis.VCommentDict
|
class VCommentDict(MutableMapping):
"""A VComment that looks like a dictionary.
This object differs from a dictionary in two ways. First,
len(comment) will still return the number of values, not the
number of keys. Secondly, iterating through the object will
iterate over (key, value) pairs, not keys. Since a key may have
multiple values, the same value may appear multiple times while
iterating.
Since Vorbis comment keys are case-insensitive, all keys are
normalized to lowercase ASCII.
"""
def __init__(self, data=None, *args, **kwargs):
self._internal = VComment()
if data is not None:
if isinstance(data, bytes):
data = BytesIO(data)
elif not hasattr(data, 'read'):
raise TypeError("VComment requires bytes or a file-like")
self.load(data, *args, **kwargs)
def _get_vendor(self):
return self._internal.vendor
def _set_vendor(self, value):
self._internal.vendor = value
vendor = property(_get_vendor, _set_vendor)
def __getitem__(self, key):
"""A list of values for the key.
This is a copy, so comment['title'].append('a title') will not
work.
"""
if not is_valid_key(key):
raise ValueError
key = key.lower()
values = [value for (k, value) in self._internal if k.lower() == key]
if not values:
raise KeyError(key)
else:
return values
def __delitem__(self, key):
"""Delete all values associated with the key."""
if not is_valid_key(key):
raise ValueError
key = key.lower()
to_delete = [x for x in self._internal if x[0].lower() == key]
if not to_delete:
raise KeyError(key)
else:
for item in to_delete:
self._internal.remove(item)
def __setitem__(self, key, values):
"""Set a key's value or values.
Setting a value overwrites all old ones. The value may be a
list of Unicode or UTF-8 strings, or a single Unicode or UTF-8
string.
"""
if not is_valid_key(key):
raise ValueError
if not isinstance(values, list):
values = [values]
try:
del(self[key])
except KeyError:
pass
if PY2:
key = key.encode('ascii')
for value in values:
self.append((key, value))
def __eq__(self, other):
if isinstance(other, (VComment, list)):
return self._internal == other
else:
return self.as_dict() == other
def __iter__(self):
return iter({k.lower() for k,v in self._internal})
def __len__(self):
return len([k for k,v in self._internal])
def as_dict(self):
"""Return a copy of the comment data in a real dict."""
d = {}
for key, value in self._internal:
d.setdefault(key.lower(), []).append(value)
return d
# Wrapper functions to expose internal VComment functionality
def load(self, fileobj, errors='replace', framing=True):
self._internal.load(fileobj, errors, framing)
def validate(self):
return self._internal.validate()
def clear(self):
self._internal.clear()
def write(self, framing=True):
return self._internal.write(framing)
def pprint(self):
return self._internal.pprint()
def index(self, value):
return self._internal.index(value)
def count(self, value):
return self._internal.count(value)
def insert(self, index, value):
self._internal.insert(index, value)
def append(self,value):
self._internal.append(value)
def reverse(self):
self._internal.reverse()
def extend(self, values):
self._internal.extend(values)
def remove(self, value):
self._internal.remove(value)
def __iadd__(values):
self._internal.__iadd__(values)
return self
|
class VCommentDict(MutableMapping):
'''A VComment that looks like a dictionary.
This object differs from a dictionary in two ways. First,
len(comment) will still return the number of values, not the
number of keys. Secondly, iterating through the object will
iterate over (key, value) pairs, not keys. Since a key may have
multiple values, the same value may appear multiple times while
iterating.
Since Vorbis comment keys are case-insensitive, all keys are
normalized to lowercase ASCII.
'''
def __init__(self, data=None, *args, **kwargs):
pass
def _get_vendor(self):
pass
def _set_vendor(self, value):
pass
def __getitem__(self, key):
'''A list of values for the key.
This is a copy, so comment['title'].append('a title') will not
work.
'''
pass
def __delitem__(self, key):
'''Delete all values associated with the key.'''
pass
def __setitem__(self, key, values):
'''Set a key's value or values.
Setting a value overwrites all old ones. The value may be a
list of Unicode or UTF-8 strings, or a single Unicode or UTF-8
string.
'''
pass
def __eq__(self, other):
pass
def __iter__(self):
pass
def __len__(self):
pass
def as_dict(self):
'''Return a copy of the comment data in a real dict.'''
pass
def load(self, fileobj, errors='replace', framing=True):
pass
def validate(self):
pass
def clear(self):
pass
def write(self, framing=True):
pass
def pprint(self):
pass
def index(self, value):
pass
def count(self, value):
pass
def insert(self, index, value):
pass
def append(self,value):
pass
def reverse(self):
pass
def extend(self, values):
pass
def remove(self, value):
pass
def __iadd__(values):
pass
| 24 | 5 | 5 | 1 | 4 | 0 | 2 | 0.25 | 1 | 6 | 1 | 5 | 23 | 1 | 23 | 23 | 151 | 42 | 87 | 34 | 63 | 22 | 83 | 32 | 59 | 6 | 1 | 2 | 38 |
147,183 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/experience_endpoint.py
|
platformrest.experience_endpoint.ExperienceEndpoint
|
class ExperienceEndpoint(object):
""" Class containing all the actions for the Experience Endpoint Resource """
def __init__(self, client):
self.client = client
def delete(self, **kwargs):
"""
Deletes an experience endpoint
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, experienceEndpoint.*, or experienceEndpoint.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceEndpointId - ID associated with the experience endpoint
* {string} includeWorkflows - If the workflows that utilize this experience endpoint should also be deleted.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If experience endpoint was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience endpoint was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "experienceEndpointId" in kwargs:
path_params["experienceEndpointId"] = kwargs["experienceEndpointId"]
if "includeWorkflows" in kwargs:
query_params["includeWorkflows"] = kwargs["includeWorkflows"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/endpoints/{experienceEndpointId}".format(**path_params)
return self.client.request("DELETE", path, params=query_params, headers=headers, body=body)
def get(self, **kwargs):
"""
Retrieves information on an experience endpoint
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, experienceEndpoint.*, or experienceEndpoint.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceEndpointId - ID associated with the experience endpoint
* {string} version - Version of this experience endpoint to return
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Experience endpoint information (https://api.losant.com/#/definitions/experienceEndpoint)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience endpoint was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "experienceEndpointId" in kwargs:
path_params["experienceEndpointId"] = kwargs["experienceEndpointId"]
if "version" in kwargs:
query_params["version"] = kwargs["version"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/endpoints/{experienceEndpointId}".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def linked_resources(self, **kwargs):
"""
Retrieves information on resources linked to an experience endpoint
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, experienceEndpoint.*, or experienceEndpoint.linkedResources.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceEndpointId - ID associated with the experience endpoint
* {string} version - Version of this experience endpoint to query
* {string} includeCustomNodes - If the result of the request should also include the details of any custom nodes referenced by returned workflows
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Linked resource information (https://api.losant.com/#/definitions/experienceLinkedResources)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience endpoint was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "experienceEndpointId" in kwargs:
path_params["experienceEndpointId"] = kwargs["experienceEndpointId"]
if "version" in kwargs:
query_params["version"] = kwargs["version"]
if "includeCustomNodes" in kwargs:
query_params["includeCustomNodes"] = kwargs["includeCustomNodes"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/endpoints/{experienceEndpointId}/linkedResources".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def patch(self, **kwargs):
"""
Updates information about an experience endpoint
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, experienceEndpoint.*, or experienceEndpoint.patch.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceEndpointId - ID associated with the experience endpoint
* {hash} experienceEndpoint - Object containing new properties of the experience endpoint (https://api.losant.com/#/definitions/experienceEndpointPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated experience endpoint information (https://api.losant.com/#/definitions/experienceEndpoint)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience endpoint was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "experienceEndpointId" in kwargs:
path_params["experienceEndpointId"] = kwargs["experienceEndpointId"]
if "experienceEndpoint" in kwargs:
body = kwargs["experienceEndpoint"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/endpoints/{experienceEndpointId}".format(**path_params)
return self.client.request("PATCH", path, params=query_params, headers=headers, body=body)
|
class ExperienceEndpoint(object):
''' Class containing all the actions for the Experience Endpoint Resource '''
def __init__(self, client):
pass
def delete(self, **kwargs):
'''
Deletes an experience endpoint
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, experienceEndpoint.*, or experienceEndpoint.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceEndpointId - ID associated with the experience endpoint
* {string} includeWorkflows - If the workflows that utilize this experience endpoint should also be deleted.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If experience endpoint was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience endpoint was not found (https://api.losant.com/#/definitions/error)
'''
pass
def get(self, **kwargs):
'''
Retrieves information on an experience endpoint
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, experienceEndpoint.*, or experienceEndpoint.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceEndpointId - ID associated with the experience endpoint
* {string} version - Version of this experience endpoint to return
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Experience endpoint information (https://api.losant.com/#/definitions/experienceEndpoint)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience endpoint was not found (https://api.losant.com/#/definitions/error)
'''
pass
def linked_resources(self, **kwargs):
'''
Retrieves information on resources linked to an experience endpoint
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, experienceEndpoint.*, or experienceEndpoint.linkedResources.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceEndpointId - ID associated with the experience endpoint
* {string} version - Version of this experience endpoint to query
* {string} includeCustomNodes - If the result of the request should also include the details of any custom nodes referenced by returned workflows
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Linked resource information (https://api.losant.com/#/definitions/experienceLinkedResources)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience endpoint was not found (https://api.losant.com/#/definitions/error)
'''
pass
def patch(self, **kwargs):
'''
Updates information about an experience endpoint
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, experienceEndpoint.*, or experienceEndpoint.patch.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceEndpointId - ID associated with the experience endpoint
* {hash} experienceEndpoint - Object containing new properties of the experience endpoint (https://api.losant.com/#/definitions/experienceEndpointPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated experience endpoint information (https://api.losant.com/#/definitions/experienceEndpoint)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience endpoint was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 6 | 5 | 41 | 6 | 18 | 17 | 7 | 0.97 | 1 | 0 | 0 | 0 | 5 | 1 | 5 | 5 | 212 | 37 | 89 | 27 | 83 | 86 | 89 | 27 | 83 | 9 | 1 | 1 | 34 |
147,184 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/experience_domains.py
|
platformrest.experience_domains.ExperienceDomains
|
class ExperienceDomains(object):
""" Class containing all the actions for the Experience Domains Resource """
def __init__(self, client):
self.client = client
def get(self, **kwargs):
"""
Returns the experience domains for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.cli, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.cli, all.User.read, experienceDomains.*, or experienceDomains.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of experience domains (https://api.losant.com/#/definitions/experienceDomains)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/domains".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def post(self, **kwargs):
"""
Create a new experience domain for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, experienceDomains.*, or experienceDomains.post.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} experienceDomain - New experience domain information (https://api.losant.com/#/definitions/experienceDomainPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created experience domain (https://api.losant.com/#/definitions/experienceDomain)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "experienceDomain" in kwargs:
body = kwargs["experienceDomain"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/domains".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
|
class ExperienceDomains(object):
''' Class containing all the actions for the Experience Domains Resource '''
def __init__(self, client):
pass
def get(self, **kwargs):
'''
Returns the experience domains for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.cli, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.cli, all.User.read, experienceDomains.*, or experienceDomains.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of experience domains (https://api.losant.com/#/definitions/experienceDomains)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
def post(self, **kwargs):
'''
Create a new experience domain for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, experienceDomains.*, or experienceDomains.post.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} experienceDomain - New experience domain information (https://api.losant.com/#/definitions/experienceDomainPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created experience domain (https://api.losant.com/#/definitions/experienceDomain)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 4 | 3 | 31 | 5 | 13 | 13 | 5 | 1.03 | 1 | 0 | 0 | 0 | 3 | 1 | 3 | 3 | 98 | 19 | 39 | 15 | 35 | 40 | 39 | 15 | 35 | 7 | 1 | 1 | 14 |
147,185 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/experience_domain.py
|
platformrest.experience_domain.ExperienceDomain
|
class ExperienceDomain(object):
""" Class containing all the actions for the Experience Domain Resource """
def __init__(self, client):
self.client = client
def delete(self, **kwargs):
"""
Deletes an experience domain
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, experienceDomain.*, or experienceDomain.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceDomainId - ID associated with the experience domain
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If experience domain was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience domain was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "experienceDomainId" in kwargs:
path_params["experienceDomainId"] = kwargs["experienceDomainId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/domains/{experienceDomainId}".format(**path_params)
return self.client.request("DELETE", path, params=query_params, headers=headers, body=body)
def get(self, **kwargs):
"""
Retrieves information on an experience domain
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, experienceDomain.*, or experienceDomain.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceDomainId - ID associated with the experience domain
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Experience domain information (https://api.losant.com/#/definitions/experienceDomain)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience domain was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "experienceDomainId" in kwargs:
path_params["experienceDomainId"] = kwargs["experienceDomainId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/domains/{experienceDomainId}".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def patch(self, **kwargs):
"""
Updates information about an experience domain
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, experienceDomain.*, or experienceDomain.patch.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceDomainId - ID associated with the experience domain
* {hash} experienceDomain - Object containing new properties of the experience domain (https://api.losant.com/#/definitions/experienceDomainPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated experience domain information (https://api.losant.com/#/definitions/experienceDomain)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience domain was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "experienceDomainId" in kwargs:
path_params["experienceDomainId"] = kwargs["experienceDomainId"]
if "experienceDomain" in kwargs:
body = kwargs["experienceDomain"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/domains/{experienceDomainId}".format(**path_params)
return self.client.request("PATCH", path, params=query_params, headers=headers, body=body)
|
class ExperienceDomain(object):
''' Class containing all the actions for the Experience Domain Resource '''
def __init__(self, client):
pass
def delete(self, **kwargs):
'''
Deletes an experience domain
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, experienceDomain.*, or experienceDomain.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceDomainId - ID associated with the experience domain
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If experience domain was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience domain was not found (https://api.losant.com/#/definitions/error)
'''
pass
def get(self, **kwargs):
'''
Retrieves information on an experience domain
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, experienceDomain.*, or experienceDomain.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceDomainId - ID associated with the experience domain
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Experience domain information (https://api.losant.com/#/definitions/experienceDomain)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience domain was not found (https://api.losant.com/#/definitions/error)
'''
pass
def patch(self, **kwargs):
'''
Updates information about an experience domain
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, experienceDomain.*, or experienceDomain.patch.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceDomainId - ID associated with the experience domain
* {hash} experienceDomain - Object containing new properties of the experience domain (https://api.losant.com/#/definitions/experienceDomainPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated experience domain information (https://api.losant.com/#/definitions/experienceDomain)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience domain was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 5 | 4 | 37 | 6 | 15 | 15 | 6 | 1 | 1 | 0 | 0 | 0 | 4 | 1 | 4 | 4 | 152 | 28 | 62 | 21 | 57 | 62 | 62 | 21 | 57 | 8 | 1 | 1 | 23 |
147,186 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/experience.py
|
platformrest.experience.Experience
|
class Experience(object):
""" Class containing all the actions for the Experience Resource """
def __init__(self, client):
self.client = client
def bootstrap(self, **kwargs):
"""
Bootstraps the experience for this application with standard endpoints and views
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.cli, all.Organization, all.User, all.User.cli, experience.*, or experience.bootstrap.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} options - Bootstrap options (https://api.losant.com/#/definitions/experienceBootstrapOptions)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If bootstrap was successful (https://api.losant.com/#/definitions/experienceBootstrapResult)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "options" in kwargs:
body = kwargs["options"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/bootstrap".format(**path_params)
return self.client.request("PATCH", path, params=query_params, headers=headers, body=body)
def delete(self, **kwargs):
"""
Deletes multiple parts of an experience including users, groups, slugs, domains, versions, endpoints, views, and workflows
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, experience.*, or experience.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} keepUsers - If this is set, Experience Users will not be removed.
* {string} keepGroups - If this is set, Experience Groups will not be removed.
* {string} keepSlugs - If this is set, Experience Slugs will not be removed.
* {string} keepDomains - If this is set, Experience Domains will not be removed.
* {string} removeVersions - If this is set, all Experience Versions and their contents will be removed (except for develop).
* {string} keepViews - If this is set, Experience Views (in the develop version) will not be removed.
* {string} keepEndpoints - If this is set, Experience Endpoints (in the develop version) will not be removed.
* {string} removeWorkflows - If this is set, all Experience Workflows (in the develop version) will ve removed.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If deletion was successful (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "keepUsers" in kwargs:
query_params["keepUsers"] = kwargs["keepUsers"]
if "keepGroups" in kwargs:
query_params["keepGroups"] = kwargs["keepGroups"]
if "keepSlugs" in kwargs:
query_params["keepSlugs"] = kwargs["keepSlugs"]
if "keepDomains" in kwargs:
query_params["keepDomains"] = kwargs["keepDomains"]
if "removeVersions" in kwargs:
query_params["removeVersions"] = kwargs["removeVersions"]
if "keepViews" in kwargs:
query_params["keepViews"] = kwargs["keepViews"]
if "keepEndpoints" in kwargs:
query_params["keepEndpoints"] = kwargs["keepEndpoints"]
if "removeWorkflows" in kwargs:
query_params["removeWorkflows"] = kwargs["removeWorkflows"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience".format(**path_params)
return self.client.request("DELETE", path, params=query_params, headers=headers, body=body)
|
class Experience(object):
''' Class containing all the actions for the Experience Resource '''
def __init__(self, client):
pass
def bootstrap(self, **kwargs):
'''
Bootstraps the experience for this application with standard endpoints and views
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.cli, all.Organization, all.User, all.User.cli, experience.*, or experience.bootstrap.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} options - Bootstrap options (https://api.losant.com/#/definitions/experienceBootstrapOptions)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If bootstrap was successful (https://api.losant.com/#/definitions/experienceBootstrapResult)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
def delete(self, **kwargs):
'''
Deletes multiple parts of an experience including users, groups, slugs, domains, versions, endpoints, views, and workflows
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, experience.*, or experience.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} keepUsers - If this is set, Experience Users will not be removed.
* {string} keepGroups - If this is set, Experience Groups will not be removed.
* {string} keepSlugs - If this is set, Experience Slugs will not be removed.
* {string} keepDomains - If this is set, Experience Domains will not be removed.
* {string} removeVersions - If this is set, all Experience Versions and their contents will be removed (except for develop).
* {string} keepViews - If this is set, Experience Views (in the develop version) will not be removed.
* {string} keepEndpoints - If this is set, Experience Endpoints (in the develop version) will not be removed.
* {string} removeWorkflows - If this is set, all Experience Workflows (in the develop version) will ve removed.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If deletion was successful (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 4 | 3 | 39 | 5 | 18 | 16 | 7 | 0.87 | 1 | 0 | 0 | 0 | 3 | 1 | 3 | 3 | 122 | 19 | 55 | 15 | 51 | 48 | 55 | 15 | 51 | 14 | 1 | 1 | 22 |
147,187 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/dashboards.py
|
platformrest.dashboards.Dashboards
|
class Dashboards(object):
""" Class containing all the actions for the Dashboards Resource """
def __init__(self, client):
self.client = client
def get(self, **kwargs):
"""
Returns the dashboards the current user has permission to see
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.Organization.read, all.User, all.User.read, dashboards.*, or dashboards.get.
Parameters:
* {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, ownerId, applicationId, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} applicationId - If not provided, return all dashboards. If provided but blank, only return dashboards that are not linked to applications. If provided and an id, only return dashboards linked to the given application id.
* {string} orgId - If not provided, return all dashboards. If provided but blank, only return dashboards belonging to the current user. If provided and an id, only return dashboards belonging to the given organization id.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of dashboards (https://api.losant.com/#/definitions/dashboards)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "sortField" in kwargs:
query_params["sortField"] = kwargs["sortField"]
if "sortDirection" in kwargs:
query_params["sortDirection"] = kwargs["sortDirection"]
if "page" in kwargs:
query_params["page"] = kwargs["page"]
if "perPage" in kwargs:
query_params["perPage"] = kwargs["perPage"]
if "filterField" in kwargs:
query_params["filterField"] = kwargs["filterField"]
if "filter" in kwargs:
query_params["filter"] = kwargs["filter"]
if "applicationId" in kwargs:
query_params["applicationId"] = kwargs["applicationId"]
if "orgId" in kwargs:
query_params["orgId"] = kwargs["orgId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/dashboards".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def post(self, **kwargs):
"""
Create a new dashboard
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.User, dashboards.*, or dashboards.post.
Parameters:
* {hash} dashboard - New dashboard information (https://api.losant.com/#/definitions/dashboardPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created dashboard (https://api.losant.com/#/definitions/dashboard)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "dashboard" in kwargs:
body = kwargs["dashboard"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/dashboards".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
|
class Dashboards(object):
''' Class containing all the actions for the Dashboards Resource '''
def __init__(self, client):
pass
def get(self, **kwargs):
'''
Returns the dashboards the current user has permission to see
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.Organization.read, all.User, all.User.read, dashboards.*, or dashboards.get.
Parameters:
* {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, ownerId, applicationId, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} applicationId - If not provided, return all dashboards. If provided but blank, only return dashboards that are not linked to applications. If provided and an id, only return dashboards linked to the given application id.
* {string} orgId - If not provided, return all dashboards. If provided but blank, only return dashboards belonging to the current user. If provided and an id, only return dashboards belonging to the given organization id.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of dashboards (https://api.losant.com/#/definitions/dashboards)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
'''
pass
def post(self, **kwargs):
'''
Create a new dashboard
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.User, dashboards.*, or dashboards.post.
Parameters:
* {hash} dashboard - New dashboard information (https://api.losant.com/#/definitions/dashboardPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created dashboard (https://api.losant.com/#/definitions/dashboard)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
'''
pass
| 4 | 3 | 36 | 5 | 17 | 14 | 7 | 0.86 | 1 | 0 | 0 | 0 | 3 | 1 | 3 | 3 | 114 | 19 | 51 | 15 | 47 | 44 | 51 | 15 | 47 | 13 | 1 | 1 | 20 |
147,188 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/event.py
|
platformrest.event.Event
|
class Event(object):
""" Class containing all the actions for the Event Resource """
def __init__(self, client):
self.client = client
def delete(self, **kwargs):
"""
Deletes an event
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, event.*, or event.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} eventId - ID associated with the event
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If event was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if event was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "eventId" in kwargs:
path_params["eventId"] = kwargs["eventId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/events/{eventId}".format(**path_params)
return self.client.request("DELETE", path, params=query_params, headers=headers, body=body)
def get(self, **kwargs):
"""
Retrieves information on an event
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, event.*, or event.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} eventId - ID associated with the event
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Event information (https://api.losant.com/#/definitions/event)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if event was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "eventId" in kwargs:
path_params["eventId"] = kwargs["eventId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/events/{eventId}".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def patch(self, **kwargs):
"""
Updates information about an event
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, event.*, or event.patch.
Parameters:
* {string} applicationId - ID associated with the application
* {string} eventId - ID associated with the event
* {hash} event - Object containing new properties of the event (https://api.losant.com/#/definitions/eventPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated event information (https://api.losant.com/#/definitions/event)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if event is not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "eventId" in kwargs:
path_params["eventId"] = kwargs["eventId"]
if "event" in kwargs:
body = kwargs["event"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/events/{eventId}".format(**path_params)
return self.client.request("PATCH", path, params=query_params, headers=headers, body=body)
|
class Event(object):
''' Class containing all the actions for the Event Resource '''
def __init__(self, client):
pass
def delete(self, **kwargs):
'''
Deletes an event
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, event.*, or event.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} eventId - ID associated with the event
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If event was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if event was not found (https://api.losant.com/#/definitions/error)
'''
pass
def get(self, **kwargs):
'''
Retrieves information on an event
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, event.*, or event.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} eventId - ID associated with the event
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Event information (https://api.losant.com/#/definitions/event)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if event was not found (https://api.losant.com/#/definitions/error)
'''
pass
def patch(self, **kwargs):
'''
Updates information about an event
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, event.*, or event.patch.
Parameters:
* {string} applicationId - ID associated with the application
* {string} eventId - ID associated with the event
* {hash} event - Object containing new properties of the event (https://api.losant.com/#/definitions/eventPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated event information (https://api.losant.com/#/definitions/event)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if event is not found (https://api.losant.com/#/definitions/error)
'''
pass
| 5 | 4 | 37 | 6 | 15 | 15 | 6 | 1 | 1 | 0 | 0 | 0 | 4 | 1 | 4 | 4 | 152 | 28 | 62 | 21 | 57 | 62 | 62 | 21 | 57 | 8 | 1 | 1 | 23 |
147,189 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/dashboard.py
|
platformrest.dashboard.Dashboard
|
class Dashboard(object):
""" Class containing all the actions for the Dashboard Resource """
def __init__(self, client):
self.client = client
def delete(self, **kwargs):
"""
Deletes a dashboard
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.User, dashboard.*, or dashboard.delete.
Parameters:
* {string} dashboardId - ID of the associated dashboard
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If dashboard was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if dashboard was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "dashboardId" in kwargs:
path_params["dashboardId"] = kwargs["dashboardId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/dashboards/{dashboardId}".format(**path_params)
return self.client.request("DELETE", path, params=query_params, headers=headers, body=body)
def get(self, **kwargs):
"""
Retrieves information on a dashboard
Authentication:
No api access token is required to call this action.
Parameters:
* {string} dashboardId - ID of the associated dashboard
* {string} password - Password for password-protected dashboards
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Dashboard information (https://api.losant.com/#/definitions/dashboard)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if dashboard was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "dashboardId" in kwargs:
path_params["dashboardId"] = kwargs["dashboardId"]
if "password" in kwargs:
query_params["password"] = kwargs["password"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/dashboards/{dashboardId}".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def patch(self, **kwargs):
"""
Updates information about a dashboard
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.User, dashboard.*, or dashboard.patch.
Parameters:
* {string} dashboardId - ID of the associated dashboard
* {hash} dashboard - Object containing new dashboard properties (https://api.losant.com/#/definitions/dashboardPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Update dashboard information (https://api.losant.com/#/definitions/dashboard)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if dashboard was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "dashboardId" in kwargs:
path_params["dashboardId"] = kwargs["dashboardId"]
if "dashboard" in kwargs:
body = kwargs["dashboard"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/dashboards/{dashboardId}".format(**path_params)
return self.client.request("PATCH", path, params=query_params, headers=headers, body=body)
def send_report(self, **kwargs):
"""
Sends a snapshot of a dashboard
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.User, dashboard.*, or dashboard.sendReport.
Parameters:
* {string} dashboardId - ID of the associated dashboard
* {hash} reportConfig - Object containing report options (https://api.losant.com/#/definitions/dashboardSendReport)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 202 - If dashboard report was enqueued to be sent (https://api.losant.com/#/definitions/jobEnqueuedResult)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if dashboard was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "dashboardId" in kwargs:
path_params["dashboardId"] = kwargs["dashboardId"]
if "reportConfig" in kwargs:
body = kwargs["reportConfig"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/dashboards/{dashboardId}".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
def validate_context(self, **kwargs):
"""
Validates a context object against the dashboard's context configuration
Authentication:
No api access token is required to call this action.
Parameters:
* {string} dashboardId - ID of the associated dashboard
* {hash} ctx - The context object to validate (https://api.losant.com/#/definitions/dashboardContextInstance)
* {string} password - Password for password-protected dashboards
* {string} duration - Duration of data to fetch in milliseconds
* {string} resolution - Resolution in milliseconds
* {string} end - End timestamp of the data, in ms since epoch
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If context is valid (https://api.losant.com/#/definitions/validateContextSuccess)
Errors:
* 400 - Error if context is invalid (https://api.losant.com/#/definitions/validateContextError)
* 404 - Error if dashboard or application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "dashboardId" in kwargs:
path_params["dashboardId"] = kwargs["dashboardId"]
if "ctx" in kwargs:
body = kwargs["ctx"]
if "password" in kwargs:
query_params["password"] = kwargs["password"]
if "duration" in kwargs:
query_params["duration"] = kwargs["duration"]
if "resolution" in kwargs:
query_params["resolution"] = kwargs["resolution"]
if "end" in kwargs:
query_params["end"] = kwargs["end"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/dashboards/{dashboardId}/validateContext".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
|
class Dashboard(object):
''' Class containing all the actions for the Dashboard Resource '''
def __init__(self, client):
pass
def delete(self, **kwargs):
'''
Deletes a dashboard
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.User, dashboard.*, or dashboard.delete.
Parameters:
* {string} dashboardId - ID of the associated dashboard
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If dashboard was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if dashboard was not found (https://api.losant.com/#/definitions/error)
'''
pass
def get(self, **kwargs):
'''
Retrieves information on a dashboard
Authentication:
No api access token is required to call this action.
Parameters:
* {string} dashboardId - ID of the associated dashboard
* {string} password - Password for password-protected dashboards
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Dashboard information (https://api.losant.com/#/definitions/dashboard)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if dashboard was not found (https://api.losant.com/#/definitions/error)
'''
pass
def patch(self, **kwargs):
'''
Updates information about a dashboard
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.User, dashboard.*, or dashboard.patch.
Parameters:
* {string} dashboardId - ID of the associated dashboard
* {hash} dashboard - Object containing new dashboard properties (https://api.losant.com/#/definitions/dashboardPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Update dashboard information (https://api.losant.com/#/definitions/dashboard)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if dashboard was not found (https://api.losant.com/#/definitions/error)
'''
pass
def send_report(self, **kwargs):
'''
Sends a snapshot of a dashboard
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.User, dashboard.*, or dashboard.sendReport.
Parameters:
* {string} dashboardId - ID of the associated dashboard
* {hash} reportConfig - Object containing report options (https://api.losant.com/#/definitions/dashboardSendReport)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 202 - If dashboard report was enqueued to be sent (https://api.losant.com/#/definitions/jobEnqueuedResult)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if dashboard was not found (https://api.losant.com/#/definitions/error)
'''
pass
def validate_context(self, **kwargs):
'''
Validates a context object against the dashboard's context configuration
Authentication:
No api access token is required to call this action.
Parameters:
* {string} dashboardId - ID of the associated dashboard
* {hash} ctx - The context object to validate (https://api.losant.com/#/definitions/dashboardContextInstance)
* {string} password - Password for password-protected dashboards
* {string} duration - Duration of data to fetch in milliseconds
* {string} resolution - Resolution in milliseconds
* {string} end - End timestamp of the data, in ms since epoch
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If context is valid (https://api.losant.com/#/definitions/validateContextSuccess)
Errors:
* 400 - Error if context is invalid (https://api.losant.com/#/definitions/validateContextError)
* 404 - Error if dashboard or application was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 7 | 6 | 40 | 7 | 17 | 16 | 7 | 0.94 | 1 | 0 | 0 | 0 | 6 | 1 | 6 | 6 | 248 | 46 | 104 | 33 | 97 | 98 | 104 | 33 | 97 | 11 | 1 | 1 | 39 |
147,190 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/credentials.py
|
platformrest.credentials.Credentials
|
class Credentials(object):
""" Class containing all the actions for the Credentials Resource """
def __init__(self, client):
self.client = client
def get(self, **kwargs):
"""
Returns a collection of credentials for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, credentials.*, or credentials.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} sortField - Field to sort the results by. Accepted values are: name, type, creationDate, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name, type
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of credentials (https://api.losant.com/#/definitions/credentials)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "sortField" in kwargs:
query_params["sortField"] = kwargs["sortField"]
if "sortDirection" in kwargs:
query_params["sortDirection"] = kwargs["sortDirection"]
if "page" in kwargs:
query_params["page"] = kwargs["page"]
if "perPage" in kwargs:
query_params["perPage"] = kwargs["perPage"]
if "filterField" in kwargs:
query_params["filterField"] = kwargs["filterField"]
if "filter" in kwargs:
query_params["filter"] = kwargs["filter"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/credentials".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def post(self, **kwargs):
"""
Create a new credential for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, credentials.*, or credentials.post.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} credential - Credential information (https://api.losant.com/#/definitions/credentialPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created credential (https://api.losant.com/#/definitions/credential)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "credential" in kwargs:
body = kwargs["credential"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/credentials".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
|
class Credentials(object):
''' Class containing all the actions for the Credentials Resource '''
def __init__(self, client):
pass
def get(self, **kwargs):
'''
Returns a collection of credentials for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, credentials.*, or credentials.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} sortField - Field to sort the results by. Accepted values are: name, type, creationDate, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name, type
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of credentials (https://api.losant.com/#/definitions/credentials)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
def post(self, **kwargs):
'''
Create a new credential for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, credentials.*, or credentials.post.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} credential - Credential information (https://api.losant.com/#/definitions/credentialPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created credential (https://api.losant.com/#/definitions/credential)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 4 | 3 | 37 | 5 | 17 | 15 | 7 | 0.9 | 1 | 0 | 0 | 0 | 3 | 1 | 3 | 3 | 116 | 19 | 51 | 15 | 47 | 46 | 51 | 15 | 47 | 12 | 1 | 1 | 20 |
147,191 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/client.py
|
platformrest.client.Client
|
class Client(object):
"""
Platform API
User API for accessing platform data
Built For Version 1.27.2
"""
def __init__(self, auth_token=None, url="https://api.losant.com"):
self.url = url
self.auth_token = auth_token
self.application = Application(self)
self.application_api_token = ApplicationApiToken(self)
self.application_api_tokens = ApplicationApiTokens(self)
self.application_certificate = ApplicationCertificate(self)
self.application_certificate_authorities = ApplicationCertificateAuthorities(self)
self.application_certificate_authority = ApplicationCertificateAuthority(self)
self.application_certificates = ApplicationCertificates(self)
self.application_dashboard = ApplicationDashboard(self)
self.application_dashboards = ApplicationDashboards(self)
self.application_key = ApplicationKey(self)
self.application_keys = ApplicationKeys(self)
self.application_template = ApplicationTemplate(self)
self.application_templates = ApplicationTemplates(self)
self.applications = Applications(self)
self.audit_log = AuditLog(self)
self.audit_logs = AuditLogs(self)
self.auth = Auth(self)
self.credential = Credential(self)
self.credentials = Credentials(self)
self.dashboard = Dashboard(self)
self.dashboards = Dashboards(self)
self.data = Data(self)
self.data_table = DataTable(self)
self.data_table_row = DataTableRow(self)
self.data_table_rows = DataTableRows(self)
self.data_tables = DataTables(self)
self.device = Device(self)
self.device_recipe = DeviceRecipe(self)
self.device_recipes = DeviceRecipes(self)
self.devices = Devices(self)
self.edge_deployment = EdgeDeployment(self)
self.edge_deployments = EdgeDeployments(self)
self.embedded_deployment = EmbeddedDeployment(self)
self.embedded_deployments = EmbeddedDeployments(self)
self.event = Event(self)
self.events = Events(self)
self.experience = Experience(self)
self.experience_domain = ExperienceDomain(self)
self.experience_domains = ExperienceDomains(self)
self.experience_endpoint = ExperienceEndpoint(self)
self.experience_endpoints = ExperienceEndpoints(self)
self.experience_group = ExperienceGroup(self)
self.experience_groups = ExperienceGroups(self)
self.experience_slug = ExperienceSlug(self)
self.experience_slugs = ExperienceSlugs(self)
self.experience_user = ExperienceUser(self)
self.experience_users = ExperienceUsers(self)
self.experience_version = ExperienceVersion(self)
self.experience_versions = ExperienceVersions(self)
self.experience_view = ExperienceView(self)
self.experience_views = ExperienceViews(self)
self.file = File(self)
self.files = Files(self)
self.flow = Flow(self)
self.flow_version = FlowVersion(self)
self.flow_versions = FlowVersions(self)
self.flows = Flows(self)
self.instance = Instance(self)
self.instance_api_token = InstanceApiToken(self)
self.instance_api_tokens = InstanceApiTokens(self)
self.instance_audit_log = InstanceAuditLog(self)
self.instance_audit_logs = InstanceAuditLogs(self)
self.instance_custom_node = InstanceCustomNode(self)
self.instance_custom_nodes = InstanceCustomNodes(self)
self.instance_member = InstanceMember(self)
self.instance_members = InstanceMembers(self)
self.instance_notification_rule = InstanceNotificationRule(self)
self.instance_notification_rules = InstanceNotificationRules(self)
self.instance_org = InstanceOrg(self)
self.instance_org_invite = InstanceOrgInvite(self)
self.instance_org_invites = InstanceOrgInvites(self)
self.instance_org_member = InstanceOrgMember(self)
self.instance_org_members = InstanceOrgMembers(self)
self.instance_orgs = InstanceOrgs(self)
self.instance_sandbox = InstanceSandbox(self)
self.instance_sandboxes = InstanceSandboxes(self)
self.instances = Instances(self)
self.integration = Integration(self)
self.integrations = Integrations(self)
self.me = Me(self)
self.notebook = Notebook(self)
self.notebooks = Notebooks(self)
self.org = Org(self)
self.org_invites = OrgInvites(self)
self.orgs = Orgs(self)
self.resource_job = ResourceJob(self)
self.resource_jobs = ResourceJobs(self)
self.user_api_token = UserApiToken(self)
self.user_api_tokens = UserApiTokens(self)
self.webhook = Webhook(self)
self.webhooks = Webhooks(self)
def request(self, method, path, params=None, headers=None, body=None):
""" Base method for making a Platform API request """
if not headers:
headers = {}
if not params:
params = {}
headers["Accept"] = "application/json"
headers["Accept-Version"] = "^1.27.2"
if self.auth_token:
headers["Authorization"] = "Bearer {0}".format(self.auth_token)
path = self.url + path
params = self.flatten_params(params)
response = requests.request(method, path, params=params, headers=headers, json=body)
result = response.text
try:
result = response.json()
except Exception:
pass
if response.status_code >= 400:
raise PlatformError(response.status_code, result)
return result
def flatten_params(self, data, base_key=None):
""" Flatten out nested arrays and dicts in query params into correct format """
result = {}
if data is None:
return result
map_data = None
if not isinstance(data, Mapping):
map_data = []
for idx, val in enumerate(data):
map_data.append([str(idx), val])
else:
map_data = list(data.items())
for key, value in map_data:
if not base_key is None:
key = base_key + "[" + key + "]"
if isinstance(value, basestring) or not hasattr(value, "__iter__"):
result[key] = value
else:
result.update(self.flatten_params(value, key))
return result
|
class Client(object):
'''
Platform API
User API for accessing platform data
Built For Version 1.27.2
'''
def __init__(self, auth_token=None, url="https://api.losant.com"):
pass
def request(self, method, path, params=None, headers=None, body=None):
''' Base method for making a Platform API request '''
pass
def flatten_params(self, data, base_key=None):
''' Flatten out nested arrays and dicts in query params into correct format '''
pass
| 4 | 3 | 48 | 3 | 44 | 1 | 5 | 0.05 | 1 | 97 | 92 | 0 | 3 | 93 | 3 | 3 | 156 | 15 | 134 | 103 | 130 | 7 | 132 | 103 | 128 | 7 | 1 | 2 | 14 |
147,192 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/events.py
|
platformrest.events.Events
|
class Events(object):
""" Class containing all the actions for the Events Resource """
def __init__(self, client):
self.client = client
def delete(self, **kwargs):
"""
Delete events
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, events.*, or events.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} query - Query to apply to filter the events (https://api.losant.com/#/definitions/advancedEventQuery)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If request successfully deletes a set of Events (https://api.losant.com/#/definitions/eventsDeleted)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if events were not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "query" in kwargs:
body = kwargs["query"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/events/delete".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
def export(self, **kwargs):
"""
Request an export of an application's event data
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, events.*, or events.export.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} exportData - Export options for events (https://api.losant.com/#/definitions/eventsExport)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 202 - If generation of export was successfully started (https://api.losant.com/#/definitions/jobEnqueuedResult)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "exportData" in kwargs:
body = kwargs["exportData"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/events/export".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
def get(self, **kwargs):
"""
Returns the events for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, events.*, or events.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} sortField - Field to sort the results by. Accepted values are: subject, id, creationDate, lastUpdated, level, state, deviceId
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: subject
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} state - If provided, return events only in the given state. Accepted values are: new, acknowledged, resolved
* {hash} query - Event filter JSON object which overrides the filterField, filter, and state parameters. (https://api.losant.com/#/definitions/advancedEventQuery)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of events (https://api.losant.com/#/definitions/events)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "sortField" in kwargs:
query_params["sortField"] = kwargs["sortField"]
if "sortDirection" in kwargs:
query_params["sortDirection"] = kwargs["sortDirection"]
if "page" in kwargs:
query_params["page"] = kwargs["page"]
if "perPage" in kwargs:
query_params["perPage"] = kwargs["perPage"]
if "filterField" in kwargs:
query_params["filterField"] = kwargs["filterField"]
if "filter" in kwargs:
query_params["filter"] = kwargs["filter"]
if "state" in kwargs:
query_params["state"] = kwargs["state"]
if "query" in kwargs:
query_params["query"] = json.dumps(kwargs["query"])
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/events".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def most_recent_by_severity(self, **kwargs):
"""
Returns the first new event ordered by severity and then creation
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, events.*, or events.mostRecentBySeverity.
Parameters:
* {string} applicationId - ID associated with the application
* {string} filter - Filter to apply against event subjects. Supports globbing. Blank or not provided means no filtering.
* {hash} query - Event filter JSON object which overrides the filter parameter. (https://api.losant.com/#/definitions/advancedEventQuery)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - The event, plus count of currently new events (https://api.losant.com/#/definitions/eventPlusNewCount)
Errors:
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "filter" in kwargs:
query_params["filter"] = kwargs["filter"]
if "query" in kwargs:
query_params["query"] = json.dumps(kwargs["query"])
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/events/mostRecentBySeverity".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def patch(self, **kwargs):
"""
Asynchronously updates information for matching events by subject and/or current state
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, events.*, or events.patch.
Parameters:
* {string} applicationId - ID associated with the application
* {string} filterField - Field to filter the events to act on by. Blank or not provided means no filtering. Accepted values are: subject
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} state - If provided, act on events only in the given state. Accepted values are: new, acknowledged, resolved
* {hash} query - Event filter JSON object which overrides the filterField, filter, and state parameters. (https://api.losant.com/#/definitions/advancedEventQuery)
* {hash} updates - Object containing updated information for the events (https://api.losant.com/#/definitions/eventPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If the bulk update has been completed (https://api.losant.com/#/definitions/success)
* 202 - If a bulk update job has been enqueued (https://api.losant.com/#/definitions/jobEnqueuedResult)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application is not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "filterField" in kwargs:
query_params["filterField"] = kwargs["filterField"]
if "filter" in kwargs:
query_params["filter"] = kwargs["filter"]
if "state" in kwargs:
query_params["state"] = kwargs["state"]
if "query" in kwargs:
query_params["query"] = json.dumps(kwargs["query"])
if "updates" in kwargs:
body = kwargs["updates"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/events".format(**path_params)
return self.client.request("PATCH", path, params=query_params, headers=headers, body=body)
def post(self, **kwargs):
"""
Create a new event for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, events.*, or events.post.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} event - New event information (https://api.losant.com/#/definitions/eventPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created event (https://api.losant.com/#/definitions/event)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
* 429 - Error if event creation rate limit exceeded (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "event" in kwargs:
body = kwargs["event"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/events".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
|
class Events(object):
''' Class containing all the actions for the Events Resource '''
def __init__(self, client):
pass
def delete(self, **kwargs):
'''
Delete events
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, events.*, or events.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} query - Query to apply to filter the events (https://api.losant.com/#/definitions/advancedEventQuery)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If request successfully deletes a set of Events (https://api.losant.com/#/definitions/eventsDeleted)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if events were not found (https://api.losant.com/#/definitions/error)
'''
pass
def export(self, **kwargs):
'''
Request an export of an application's event data
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, events.*, or events.export.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} exportData - Export options for events (https://api.losant.com/#/definitions/eventsExport)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 202 - If generation of export was successfully started (https://api.losant.com/#/definitions/jobEnqueuedResult)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
def get(self, **kwargs):
'''
Returns the events for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, events.*, or events.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} sortField - Field to sort the results by. Accepted values are: subject, id, creationDate, lastUpdated, level, state, deviceId
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: subject
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} state - If provided, return events only in the given state. Accepted values are: new, acknowledged, resolved
* {hash} query - Event filter JSON object which overrides the filterField, filter, and state parameters. (https://api.losant.com/#/definitions/advancedEventQuery)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of events (https://api.losant.com/#/definitions/events)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
def most_recent_by_severity(self, **kwargs):
'''
Returns the first new event ordered by severity and then creation
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, events.*, or events.mostRecentBySeverity.
Parameters:
* {string} applicationId - ID associated with the application
* {string} filter - Filter to apply against event subjects. Supports globbing. Blank or not provided means no filtering.
* {hash} query - Event filter JSON object which overrides the filter parameter. (https://api.losant.com/#/definitions/advancedEventQuery)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - The event, plus count of currently new events (https://api.losant.com/#/definitions/eventPlusNewCount)
Errors:
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
def patch(self, **kwargs):
'''
Asynchronously updates information for matching events by subject and/or current state
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, events.*, or events.patch.
Parameters:
* {string} applicationId - ID associated with the application
* {string} filterField - Field to filter the events to act on by. Blank or not provided means no filtering. Accepted values are: subject
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} state - If provided, act on events only in the given state. Accepted values are: new, acknowledged, resolved
* {hash} query - Event filter JSON object which overrides the filterField, filter, and state parameters. (https://api.losant.com/#/definitions/advancedEventQuery)
* {hash} updates - Object containing updated information for the events (https://api.losant.com/#/definitions/eventPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If the bulk update has been completed (https://api.losant.com/#/definitions/success)
* 202 - If a bulk update job has been enqueued (https://api.losant.com/#/definitions/jobEnqueuedResult)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application is not found (https://api.losant.com/#/definitions/error)
'''
pass
def post(self, **kwargs):
'''
Create a new event for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, events.*, or events.post.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} event - New event information (https://api.losant.com/#/definitions/eventPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created event (https://api.losant.com/#/definitions/event)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
* 429 - Error if event creation rate limit exceeded (https://api.losant.com/#/definitions/error)
'''
pass
| 8 | 7 | 46 | 7 | 20 | 19 | 8 | 0.95 | 1 | 0 | 0 | 0 | 7 | 1 | 7 | 7 | 330 | 55 | 141 | 39 | 133 | 134 | 141 | 39 | 133 | 14 | 1 | 1 | 55 |
147,193 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/credential.py
|
platformrest.credential.Credential
|
class Credential(object):
""" Class containing all the actions for the Credential Resource """
def __init__(self, client):
self.client = client
def delete(self, **kwargs):
"""
Deletes a credential
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, credential.*, or credential.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} credentialId - ID associated with the credential
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If credential was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if credential was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "credentialId" in kwargs:
path_params["credentialId"] = kwargs["credentialId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/credentials/{credentialId}".format(**path_params)
return self.client.request("DELETE", path, params=query_params, headers=headers, body=body)
def get(self, **kwargs):
"""
Retrieves information on a credential
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, credential.*, or credential.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} credentialId - ID associated with the credential
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - credential information (https://api.losant.com/#/definitions/credential)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if credential was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "credentialId" in kwargs:
path_params["credentialId"] = kwargs["credentialId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/credentials/{credentialId}".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def linked_resources(self, **kwargs):
"""
Retrieves information on resources linked to a credential
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, credential.*, or credential.linkedResources.
Parameters:
* {string} applicationId - ID associated with the application
* {string} credentialId - ID associated with the credential
* {string} includeCustomNodes - If the result of the request should also include the details of any custom nodes referenced by returned workflows
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Linked resource information (https://api.losant.com/#/definitions/credentialLinkedResources)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if credential was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "credentialId" in kwargs:
path_params["credentialId"] = kwargs["credentialId"]
if "includeCustomNodes" in kwargs:
query_params["includeCustomNodes"] = kwargs["includeCustomNodes"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/credentials/{credentialId}/linkedResources".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def patch(self, **kwargs):
"""
Updates information about a credential
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, credential.*, or credential.patch.
Parameters:
* {string} applicationId - ID associated with the application
* {string} credentialId - ID associated with the credential
* {hash} credential - Object containing new properties of the credential (https://api.losant.com/#/definitions/credentialPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated credential information (https://api.losant.com/#/definitions/credential)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if credential was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "credentialId" in kwargs:
path_params["credentialId"] = kwargs["credentialId"]
if "credential" in kwargs:
body = kwargs["credential"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/credentials/{credentialId}".format(**path_params)
return self.client.request("PATCH", path, params=query_params, headers=headers, body=body)
|
class Credential(object):
''' Class containing all the actions for the Credential Resource '''
def __init__(self, client):
pass
def delete(self, **kwargs):
'''
Deletes a credential
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, credential.*, or credential.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} credentialId - ID associated with the credential
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If credential was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if credential was not found (https://api.losant.com/#/definitions/error)
'''
pass
def get(self, **kwargs):
'''
Retrieves information on a credential
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, credential.*, or credential.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} credentialId - ID associated with the credential
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - credential information (https://api.losant.com/#/definitions/credential)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if credential was not found (https://api.losant.com/#/definitions/error)
'''
pass
def linked_resources(self, **kwargs):
'''
Retrieves information on resources linked to a credential
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, credential.*, or credential.linkedResources.
Parameters:
* {string} applicationId - ID associated with the application
* {string} credentialId - ID associated with the credential
* {string} includeCustomNodes - If the result of the request should also include the details of any custom nodes referenced by returned workflows
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Linked resource information (https://api.losant.com/#/definitions/credentialLinkedResources)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if credential was not found (https://api.losant.com/#/definitions/error)
'''
pass
def patch(self, **kwargs):
'''
Updates information about a credential
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, credential.*, or credential.patch.
Parameters:
* {string} applicationId - ID associated with the application
* {string} credentialId - ID associated with the credential
* {hash} credential - Object containing new properties of the credential (https://api.losant.com/#/definitions/credentialPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated credential information (https://api.losant.com/#/definitions/credential)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if credential was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 6 | 5 | 39 | 6 | 16 | 16 | 6 | 1 | 1 | 0 | 0 | 0 | 5 | 1 | 5 | 5 | 203 | 37 | 83 | 27 | 77 | 83 | 83 | 27 | 77 | 8 | 1 | 1 | 31 |
147,194 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/experience_user.py
|
platformrest.experience_user.ExperienceUser
|
class ExperienceUser(object):
""" Class containing all the actions for the Experience User Resource """
def __init__(self, client):
self.client = client
def delete(self, **kwargs):
"""
Deletes an experience user
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, experienceUser.*, or experienceUser.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceUserId - ID associated with the experience user
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If experience user was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience user was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "experienceUserId" in kwargs:
path_params["experienceUserId"] = kwargs["experienceUserId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/users/{experienceUserId}".format(**path_params)
return self.client.request("DELETE", path, params=query_params, headers=headers, body=body)
def get(self, **kwargs):
"""
Retrieves information on an experience user
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, experienceUser.*, or experienceUser.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceUserId - ID associated with the experience user
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Experience user information (https://api.losant.com/#/definitions/experienceUser)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience user was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "experienceUserId" in kwargs:
path_params["experienceUserId"] = kwargs["experienceUserId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/users/{experienceUserId}".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def patch(self, **kwargs):
"""
Updates information about an experience user
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, experienceUser.*, or experienceUser.patch.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceUserId - ID associated with the experience user
* {hash} experienceUser - Object containing new properties of the experience user (https://api.losant.com/#/definitions/experienceUserPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated experience user information (https://api.losant.com/#/definitions/experienceUser)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience user was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "experienceUserId" in kwargs:
path_params["experienceUserId"] = kwargs["experienceUserId"]
if "experienceUser" in kwargs:
body = kwargs["experienceUser"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/users/{experienceUserId}".format(**path_params)
return self.client.request("PATCH", path, params=query_params, headers=headers, body=body)
|
class ExperienceUser(object):
''' Class containing all the actions for the Experience User Resource '''
def __init__(self, client):
pass
def delete(self, **kwargs):
'''
Deletes an experience user
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, experienceUser.*, or experienceUser.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceUserId - ID associated with the experience user
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If experience user was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience user was not found (https://api.losant.com/#/definitions/error)
'''
pass
def get(self, **kwargs):
'''
Retrieves information on an experience user
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, experienceUser.*, or experienceUser.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceUserId - ID associated with the experience user
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Experience user information (https://api.losant.com/#/definitions/experienceUser)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience user was not found (https://api.losant.com/#/definitions/error)
'''
pass
def patch(self, **kwargs):
'''
Updates information about an experience user
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, experienceUser.*, or experienceUser.patch.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceUserId - ID associated with the experience user
* {hash} experienceUser - Object containing new properties of the experience user (https://api.losant.com/#/definitions/experienceUserPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated experience user information (https://api.losant.com/#/definitions/experienceUser)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience user was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 5 | 4 | 37 | 6 | 15 | 15 | 6 | 1 | 1 | 0 | 0 | 0 | 4 | 1 | 4 | 4 | 152 | 28 | 62 | 21 | 57 | 62 | 62 | 21 | 57 | 8 | 1 | 1 | 23 |
147,195 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/experience_group.py
|
platformrest.experience_group.ExperienceGroup
|
class ExperienceGroup(object):
""" Class containing all the actions for the Experience Group Resource """
def __init__(self, client):
self.client = client
def delete(self, **kwargs):
"""
Deletes an experience group
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, experienceGroup.*, or experienceGroup.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceGroupId - ID associated with the experience group
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If experience group was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience group was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "experienceGroupId" in kwargs:
path_params["experienceGroupId"] = kwargs["experienceGroupId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/groups/{experienceGroupId}".format(**path_params)
return self.client.request("DELETE", path, params=query_params, headers=headers, body=body)
def get(self, **kwargs):
"""
Retrieves information on an experience group
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, experienceGroup.*, or experienceGroup.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceGroupId - ID associated with the experience group
* {string} includeDirectDeviceCount - Whether or not to return count of devices associated directly with this group
* {string} includeTotalDeviceCount - Whether or not to return count of devices associated with this group or any of its descendents
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Experience group information (https://api.losant.com/#/definitions/experienceGroup)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience group was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "experienceGroupId" in kwargs:
path_params["experienceGroupId"] = kwargs["experienceGroupId"]
if "includeDirectDeviceCount" in kwargs:
query_params["includeDirectDeviceCount"] = kwargs["includeDirectDeviceCount"]
if "includeTotalDeviceCount" in kwargs:
query_params["includeTotalDeviceCount"] = kwargs["includeTotalDeviceCount"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/groups/{experienceGroupId}".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def patch(self, **kwargs):
"""
Updates information about an experience group
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, experienceGroup.*, or experienceGroup.patch.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceGroupId - ID associated with the experience group
* {hash} experienceGroup - Object containing new properties of the experience group (https://api.losant.com/#/definitions/experienceGroupPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated experience group information (https://api.losant.com/#/definitions/experienceGroup)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience group was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "experienceGroupId" in kwargs:
path_params["experienceGroupId"] = kwargs["experienceGroupId"]
if "experienceGroup" in kwargs:
body = kwargs["experienceGroup"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/groups/{experienceGroupId}".format(**path_params)
return self.client.request("PATCH", path, params=query_params, headers=headers, body=body)
|
class ExperienceGroup(object):
''' Class containing all the actions for the Experience Group Resource '''
def __init__(self, client):
pass
def delete(self, **kwargs):
'''
Deletes an experience group
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, experienceGroup.*, or experienceGroup.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceGroupId - ID associated with the experience group
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If experience group was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience group was not found (https://api.losant.com/#/definitions/error)
'''
pass
def get(self, **kwargs):
'''
Retrieves information on an experience group
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, experienceGroup.*, or experienceGroup.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceGroupId - ID associated with the experience group
* {string} includeDirectDeviceCount - Whether or not to return count of devices associated directly with this group
* {string} includeTotalDeviceCount - Whether or not to return count of devices associated with this group or any of its descendents
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Experience group information (https://api.losant.com/#/definitions/experienceGroup)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience group was not found (https://api.losant.com/#/definitions/error)
'''
pass
def patch(self, **kwargs):
'''
Updates information about an experience group
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, experienceGroup.*, or experienceGroup.patch.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceGroupId - ID associated with the experience group
* {hash} experienceGroup - Object containing new properties of the experience group (https://api.losant.com/#/definitions/experienceGroupPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated experience group information (https://api.losant.com/#/definitions/experienceGroup)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience group was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 5 | 4 | 38 | 6 | 16 | 16 | 6 | 0.97 | 1 | 0 | 0 | 0 | 4 | 1 | 4 | 4 | 158 | 28 | 66 | 21 | 61 | 64 | 66 | 21 | 61 | 9 | 1 | 1 | 25 |
147,196 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/application_certificates.py
|
platformrest.application_certificates.ApplicationCertificates
|
class ApplicationCertificates(object):
""" Class containing all the actions for the Application Certificates Resource """
def __init__(self, client):
self.client = client
def get(self, **kwargs):
"""
Returns the application certificates for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, applicationCertificates.*, or applicationCertificates.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} sortField - Field to sort the results by. Accepted values are: certificateInfo.commonName, status, id, creationDate, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: certificateInfo.commonName, status
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of application certificates (https://api.losant.com/#/definitions/applicationCertificates)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "sortField" in kwargs:
query_params["sortField"] = kwargs["sortField"]
if "sortDirection" in kwargs:
query_params["sortDirection"] = kwargs["sortDirection"]
if "page" in kwargs:
query_params["page"] = kwargs["page"]
if "perPage" in kwargs:
query_params["perPage"] = kwargs["perPage"]
if "filterField" in kwargs:
query_params["filterField"] = kwargs["filterField"]
if "filter" in kwargs:
query_params["filter"] = kwargs["filter"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/certificates".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def post(self, **kwargs):
"""
Create a new application certificate for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, applicationCertificates.*, or applicationCertificates.post.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} applicationCertificate - Application certificate information (https://api.losant.com/#/definitions/applicationCertificatePost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created application certificate (https://api.losant.com/#/definitions/applicationCertificate)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "applicationCertificate" in kwargs:
body = kwargs["applicationCertificate"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/certificates".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
|
class ApplicationCertificates(object):
''' Class containing all the actions for the Application Certificates Resource '''
def __init__(self, client):
pass
def get(self, **kwargs):
'''
Returns the application certificates for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, applicationCertificates.*, or applicationCertificates.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} sortField - Field to sort the results by. Accepted values are: certificateInfo.commonName, status, id, creationDate, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: certificateInfo.commonName, status
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of application certificates (https://api.losant.com/#/definitions/applicationCertificates)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
def post(self, **kwargs):
'''
Create a new application certificate for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, applicationCertificates.*, or applicationCertificates.post.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} applicationCertificate - Application certificate information (https://api.losant.com/#/definitions/applicationCertificatePost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created application certificate (https://api.losant.com/#/definitions/applicationCertificate)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 4 | 3 | 37 | 5 | 17 | 15 | 7 | 0.9 | 1 | 0 | 0 | 0 | 3 | 1 | 3 | 3 | 116 | 19 | 51 | 15 | 47 | 46 | 51 | 15 | 47 | 12 | 1 | 1 | 20 |
147,197 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/flow_versions.py
|
platformrest.flow_versions.FlowVersions
|
class FlowVersions(object):
""" Class containing all the actions for the Flow Versions Resource """
def __init__(self, client):
self.client = client
def delete(self, **kwargs):
"""
Delete flow versions
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, flowVersions.*, or flowVersions.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {hash} options - Object containing flow version deletion options (https://api.losant.com/#/definitions/flowVersionsDeletePost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Object indicating number of flow versions deleted or failed (https://api.losant.com/#/definitions/bulkDeleteResponse)
* 202 - If a job was enqueued for the flow versions to be deleted (https://api.losant.com/#/definitions/jobEnqueuedResult)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "flowId" in kwargs:
path_params["flowId"] = kwargs["flowId"]
if "options" in kwargs:
body = kwargs["options"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/flows/{flowId}/versions/delete".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
def get(self, **kwargs):
"""
Returns the flow versions for a flow
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flowVersions.*, or flowVersions.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {string} sortField - Field to sort the results by. Accepted values are: version, id, creationDate, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: version
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} includeCustomNodes - If the result of the request should also include the details of any custom nodes referenced by the returned workflows
* {hash} query - Workflow filter JSON object which overrides the filterField and filter parameters. (https://api.losant.com/#/definitions/advancedFlowVersionQuery)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of flow versions (https://api.losant.com/#/definitions/flowVersions)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if flow was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "flowId" in kwargs:
path_params["flowId"] = kwargs["flowId"]
if "sortField" in kwargs:
query_params["sortField"] = kwargs["sortField"]
if "sortDirection" in kwargs:
query_params["sortDirection"] = kwargs["sortDirection"]
if "page" in kwargs:
query_params["page"] = kwargs["page"]
if "perPage" in kwargs:
query_params["perPage"] = kwargs["perPage"]
if "filterField" in kwargs:
query_params["filterField"] = kwargs["filterField"]
if "filter" in kwargs:
query_params["filter"] = kwargs["filter"]
if "includeCustomNodes" in kwargs:
query_params["includeCustomNodes"] = kwargs["includeCustomNodes"]
if "query" in kwargs:
query_params["query"] = json.dumps(kwargs["query"])
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/flows/{flowId}/versions".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def post(self, **kwargs):
"""
Create or replace a flow version for a flow
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, flowVersions.*, or flowVersions.post.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {hash} flowVersion - New flow version information (https://api.losant.com/#/definitions/flowVersionPost)
* {string} includeCustomNodes - If the result of the request should also include the details of any custom nodes referenced by the returned workflows
* {string} allowReplacement - Allow replacement of an existing flow version with same version name
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created flow version (https://api.losant.com/#/definitions/flowVersion)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if flow was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "flowId" in kwargs:
path_params["flowId"] = kwargs["flowId"]
if "flowVersion" in kwargs:
body = kwargs["flowVersion"]
if "includeCustomNodes" in kwargs:
query_params["includeCustomNodes"] = kwargs["includeCustomNodes"]
if "allowReplacement" in kwargs:
query_params["allowReplacement"] = kwargs["allowReplacement"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/flows/{flowId}/versions".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
|
class FlowVersions(object):
''' Class containing all the actions for the Flow Versions Resource '''
def __init__(self, client):
pass
def delete(self, **kwargs):
'''
Delete flow versions
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, flowVersions.*, or flowVersions.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {hash} options - Object containing flow version deletion options (https://api.losant.com/#/definitions/flowVersionsDeletePost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Object indicating number of flow versions deleted or failed (https://api.losant.com/#/definitions/bulkDeleteResponse)
* 202 - If a job was enqueued for the flow versions to be deleted (https://api.losant.com/#/definitions/jobEnqueuedResult)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
def get(self, **kwargs):
'''
Returns the flow versions for a flow
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flowVersions.*, or flowVersions.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {string} sortField - Field to sort the results by. Accepted values are: version, id, creationDate, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: version
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} includeCustomNodes - If the result of the request should also include the details of any custom nodes referenced by the returned workflows
* {hash} query - Workflow filter JSON object which overrides the filterField and filter parameters. (https://api.losant.com/#/definitions/advancedFlowVersionQuery)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of flow versions (https://api.losant.com/#/definitions/flowVersions)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if flow was not found (https://api.losant.com/#/definitions/error)
'''
pass
def post(self, **kwargs):
'''
Create or replace a flow version for a flow
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, flowVersions.*, or flowVersions.post.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {hash} flowVersion - New flow version information (https://api.losant.com/#/definitions/flowVersionPost)
* {string} includeCustomNodes - If the result of the request should also include the details of any custom nodes referenced by the returned workflows
* {string} allowReplacement - Allow replacement of an existing flow version with same version name
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created flow version (https://api.losant.com/#/definitions/flowVersion)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if flow was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 5 | 4 | 45 | 6 | 21 | 18 | 9 | 0.88 | 1 | 0 | 0 | 0 | 4 | 1 | 4 | 4 | 186 | 28 | 84 | 21 | 79 | 74 | 84 | 21 | 79 | 15 | 1 | 1 | 34 |
147,198 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/flow_version.py
|
platformrest.flow_version.FlowVersion
|
class FlowVersion(object):
""" Class containing all the actions for the Flow Version Resource """
def __init__(self, client):
self.client = client
def delete(self, **kwargs):
"""
Deletes a flow version
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, flowVersion.*, or flowVersion.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {string} flowVersionId - Version ID or version name associated with the flow version
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If flow version was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if flow version was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "flowId" in kwargs:
path_params["flowId"] = kwargs["flowId"]
if "flowVersionId" in kwargs:
path_params["flowVersionId"] = kwargs["flowVersionId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/flows/{flowId}/versions/{flowVersionId}".format(**path_params)
return self.client.request("DELETE", path, params=query_params, headers=headers, body=body)
def errors(self, **kwargs):
"""
Get information about errors that occurred during runs of this workflow version
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flowVersion.*, or flowVersion.errors.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {string} flowVersionId - Version ID or version name associated with the flow version
* {string} duration - Duration of time range in milliseconds
* {string} end - End of time range in milliseconds since epoch
* {string} limit - Maximum number of errors to return
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} deviceId - For edge workflows, the Device ID to return workflow errors for. When not included, will be errors for all device IDs.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Workflow error information (https://api.losant.com/#/definitions/flowErrors)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if flow version was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "flowId" in kwargs:
path_params["flowId"] = kwargs["flowId"]
if "flowVersionId" in kwargs:
path_params["flowVersionId"] = kwargs["flowVersionId"]
if "duration" in kwargs:
query_params["duration"] = kwargs["duration"]
if "end" in kwargs:
query_params["end"] = kwargs["end"]
if "limit" in kwargs:
query_params["limit"] = kwargs["limit"]
if "sortDirection" in kwargs:
query_params["sortDirection"] = kwargs["sortDirection"]
if "deviceId" in kwargs:
query_params["deviceId"] = kwargs["deviceId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/flows/{flowId}/versions/{flowVersionId}/errors".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def get(self, **kwargs):
"""
Retrieves information on a flow version
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flowVersion.*, or flowVersion.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {string} flowVersionId - Version ID or version name associated with the flow version
* {string} includeCustomNodes - If the result of the request should also include the details of any custom nodes referenced by the returned workflows
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Flow version information (https://api.losant.com/#/definitions/flowVersion)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if flow version was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "flowId" in kwargs:
path_params["flowId"] = kwargs["flowId"]
if "flowVersionId" in kwargs:
path_params["flowVersionId"] = kwargs["flowVersionId"]
if "includeCustomNodes" in kwargs:
query_params["includeCustomNodes"] = kwargs["includeCustomNodes"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/flows/{flowId}/versions/{flowVersionId}".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def get_log_entries(self, **kwargs):
"""
Retrieve the recent log entries about runs of this workflow version
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flowVersion.*, or flowVersion.log.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {string} flowVersionId - Version ID or version name associated with the flow version
* {string} limit - Max log entries to return (ordered by time descending)
* {string} since - Look for log entries since this time (ms since epoch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Recent log entries (https://api.losant.com/#/definitions/flowLog)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if flow version was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "flowId" in kwargs:
path_params["flowId"] = kwargs["flowId"]
if "flowVersionId" in kwargs:
path_params["flowVersionId"] = kwargs["flowVersionId"]
if "limit" in kwargs:
query_params["limit"] = kwargs["limit"]
if "since" in kwargs:
query_params["since"] = kwargs["since"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/flows/{flowId}/versions/{flowVersionId}/logs".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def patch(self, **kwargs):
"""
Updates information about a flow version
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, flowVersion.*, or flowVersion.patch.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {string} flowVersionId - Version ID or version name associated with the flow version
* {string} includeCustomNodes - If the result of the request should also include the details of any custom nodes referenced by the returned workflows
* {hash} flowVersion - Object containing new properties of the flow version (https://api.losant.com/#/definitions/flowVersionPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated flow version information (https://api.losant.com/#/definitions/flowVersion)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if flow version was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "flowId" in kwargs:
path_params["flowId"] = kwargs["flowId"]
if "flowVersionId" in kwargs:
path_params["flowVersionId"] = kwargs["flowVersionId"]
if "includeCustomNodes" in kwargs:
query_params["includeCustomNodes"] = kwargs["includeCustomNodes"]
if "flowVersion" in kwargs:
body = kwargs["flowVersion"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/flows/{flowId}/versions/{flowVersionId}".format(**path_params)
return self.client.request("PATCH", path, params=query_params, headers=headers, body=body)
def stats(self, **kwargs):
"""
Get statistics about workflow runs for this workflow version
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flowVersion.*, or flowVersion.stats.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {string} flowVersionId - Version ID or version name associated with the flow version
* {string} duration - Duration of time range in milliseconds
* {string} end - End of time range in milliseconds since epoch
* {string} resolution - Resolution in milliseconds
* {string} deviceId - For edge workflows, the device ID to return workflow stats for. When not included, will be aggregate for all device IDs.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Statistics for workflow runs (https://api.losant.com/#/definitions/flowStats)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if flow version was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "flowId" in kwargs:
path_params["flowId"] = kwargs["flowId"]
if "flowVersionId" in kwargs:
path_params["flowVersionId"] = kwargs["flowVersionId"]
if "duration" in kwargs:
query_params["duration"] = kwargs["duration"]
if "end" in kwargs:
query_params["end"] = kwargs["end"]
if "resolution" in kwargs:
query_params["resolution"] = kwargs["resolution"]
if "deviceId" in kwargs:
query_params["deviceId"] = kwargs["deviceId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/flows/{flowId}/versions/{flowVersionId}/stats".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
|
class FlowVersion(object):
''' Class containing all the actions for the Flow Version Resource '''
def __init__(self, client):
pass
def delete(self, **kwargs):
'''
Deletes a flow version
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, flowVersion.*, or flowVersion.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {string} flowVersionId - Version ID or version name associated with the flow version
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If flow version was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if flow version was not found (https://api.losant.com/#/definitions/error)
'''
pass
def errors(self, **kwargs):
'''
Get information about errors that occurred during runs of this workflow version
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flowVersion.*, or flowVersion.errors.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {string} flowVersionId - Version ID or version name associated with the flow version
* {string} duration - Duration of time range in milliseconds
* {string} end - End of time range in milliseconds since epoch
* {string} limit - Maximum number of errors to return
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} deviceId - For edge workflows, the Device ID to return workflow errors for. When not included, will be errors for all device IDs.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Workflow error information (https://api.losant.com/#/definitions/flowErrors)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if flow version was not found (https://api.losant.com/#/definitions/error)
'''
pass
def get(self, **kwargs):
'''
Retrieves information on a flow version
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flowVersion.*, or flowVersion.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {string} flowVersionId - Version ID or version name associated with the flow version
* {string} includeCustomNodes - If the result of the request should also include the details of any custom nodes referenced by the returned workflows
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Flow version information (https://api.losant.com/#/definitions/flowVersion)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if flow version was not found (https://api.losant.com/#/definitions/error)
'''
pass
def get_log_entries(self, **kwargs):
'''
Retrieve the recent log entries about runs of this workflow version
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flowVersion.*, or flowVersion.log.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {string} flowVersionId - Version ID or version name associated with the flow version
* {string} limit - Max log entries to return (ordered by time descending)
* {string} since - Look for log entries since this time (ms since epoch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Recent log entries (https://api.losant.com/#/definitions/flowLog)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if flow version was not found (https://api.losant.com/#/definitions/error)
'''
pass
def patch(self, **kwargs):
'''
Updates information about a flow version
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, flowVersion.*, or flowVersion.patch.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {string} flowVersionId - Version ID or version name associated with the flow version
* {string} includeCustomNodes - If the result of the request should also include the details of any custom nodes referenced by the returned workflows
* {hash} flowVersion - Object containing new properties of the flow version (https://api.losant.com/#/definitions/flowVersionPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated flow version information (https://api.losant.com/#/definitions/flowVersion)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if flow version was not found (https://api.losant.com/#/definitions/error)
'''
pass
def stats(self, **kwargs):
'''
Get statistics about workflow runs for this workflow version
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flowVersion.*, or flowVersion.stats.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {string} flowVersionId - Version ID or version name associated with the flow version
* {string} duration - Duration of time range in milliseconds
* {string} end - End of time range in milliseconds since epoch
* {string} resolution - Resolution in milliseconds
* {string} deviceId - For edge workflows, the device ID to return workflow stats for. When not included, will be aggregate for all device IDs.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Statistics for workflow runs (https://api.losant.com/#/definitions/flowStats)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if flow version was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 8 | 7 | 49 | 7 | 22 | 20 | 9 | 0.9 | 1 | 0 | 0 | 0 | 7 | 1 | 7 | 7 | 353 | 55 | 157 | 39 | 149 | 141 | 157 | 39 | 149 | 13 | 1 | 1 | 63 |
147,199 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/flow.py
|
platformrest.flow.Flow
|
class Flow(object):
""" Class containing all the actions for the Flow Resource """
def __init__(self, client):
self.client = client
def clear_storage_entries(self, **kwargs):
"""
Clear all storage entries
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, flow.*, or flow.clearStorageEntries.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - The current storage entries (https://api.losant.com/#/definitions/flowStorageEntries)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if flow was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "flowId" in kwargs:
path_params["flowId"] = kwargs["flowId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/flows/{flowId}/storage".format(**path_params)
return self.client.request("DELETE", path, params=query_params, headers=headers, body=body)
def delete(self, **kwargs):
"""
Deletes a flow
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, flow.*, or flow.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If flow was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if flow was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "flowId" in kwargs:
path_params["flowId"] = kwargs["flowId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/flows/{flowId}".format(**path_params)
return self.client.request("DELETE", path, params=query_params, headers=headers, body=body)
def errors(self, **kwargs):
"""
Get information about errors that occurred during runs of this workflow
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flow.*, or flow.errors.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {string} duration - Duration of time range in milliseconds
* {string} end - End of time range in milliseconds since epoch
* {string} limit - Maximum number of errors to return
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} flowVersion - Flow version name or ID. When not included, will be errors for all versions. Pass develop for just the develop version.
* {string} deviceId - For edge or embedded workflows, the Device ID for which to return workflow errors. When not included, will be errors for all device IDs.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Workflow error information (https://api.losant.com/#/definitions/flowErrors)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if flow was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "flowId" in kwargs:
path_params["flowId"] = kwargs["flowId"]
if "duration" in kwargs:
query_params["duration"] = kwargs["duration"]
if "end" in kwargs:
query_params["end"] = kwargs["end"]
if "limit" in kwargs:
query_params["limit"] = kwargs["limit"]
if "sortDirection" in kwargs:
query_params["sortDirection"] = kwargs["sortDirection"]
if "flowVersion" in kwargs:
query_params["flowVersion"] = kwargs["flowVersion"]
if "deviceId" in kwargs:
query_params["deviceId"] = kwargs["deviceId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/flows/{flowId}/errors".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def get(self, **kwargs):
"""
Retrieves information on a flow
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flow.*, or flow.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {string} includeCustomNodes - If the result of the request should also include the details of any custom nodes referenced by the returned workflows
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Flow information (https://api.losant.com/#/definitions/flow)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if flow was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "flowId" in kwargs:
path_params["flowId"] = kwargs["flowId"]
if "includeCustomNodes" in kwargs:
query_params["includeCustomNodes"] = kwargs["includeCustomNodes"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/flows/{flowId}".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def get_log_entries(self, **kwargs):
"""
Retrieve the recent log entries about runs of this workflow
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flow.*, or flow.log.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {string} limit - Max log entries to return (ordered by time descending)
* {string} since - Look for log entries since this time (ms since epoch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Recent log entries (https://api.losant.com/#/definitions/flowLog)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if flow was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "flowId" in kwargs:
path_params["flowId"] = kwargs["flowId"]
if "limit" in kwargs:
query_params["limit"] = kwargs["limit"]
if "since" in kwargs:
query_params["since"] = kwargs["since"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/flows/{flowId}/logs".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def get_storage_entries(self, **kwargs):
"""
Gets the current values in persistent storage
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flow.*, or flow.getStorageEntries.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - The current storage entries (https://api.losant.com/#/definitions/flowStorageEntries)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if flow was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "flowId" in kwargs:
path_params["flowId"] = kwargs["flowId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/flows/{flowId}/storage".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def get_storage_entries_metadata(self, **kwargs):
"""
Gets metadata about storage for this flow
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flow.*, or flow.getStorageEntriesMetadata.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - The meta data for the current storage entries (https://api.losant.com/#/definitions/flowStorageMetadata)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if flow was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "flowId" in kwargs:
path_params["flowId"] = kwargs["flowId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/flows/{flowId}/storage-metadata".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def patch(self, **kwargs):
"""
Updates information about a flow
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, flow.*, or flow.patch.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {string} includeCustomNodes - If the result of the request should also include the details of any custom nodes referenced by the returned workflows
* {hash} flow - Object containing new properties of the flow (https://api.losant.com/#/definitions/flowPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated flow information (https://api.losant.com/#/definitions/flow)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if flow is not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "flowId" in kwargs:
path_params["flowId"] = kwargs["flowId"]
if "includeCustomNodes" in kwargs:
query_params["includeCustomNodes"] = kwargs["includeCustomNodes"]
if "flow" in kwargs:
body = kwargs["flow"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/flows/{flowId}".format(**path_params)
return self.client.request("PATCH", path, params=query_params, headers=headers, body=body)
def press_virtual_button(self, **kwargs):
"""
Presses the specified virtual button on the flow
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, flow.*, or flow.pressVirtualButton.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {hash} button - Object containing button key and payload (https://api.losant.com/#/definitions/virtualButtonPress)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Virtual button was pressed (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if flow was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "flowId" in kwargs:
path_params["flowId"] = kwargs["flowId"]
if "button" in kwargs:
body = kwargs["button"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/flows/{flowId}/virtualButton".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
def set_storage_entry(self, **kwargs):
"""
Sets a storage value
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, flow.*, or flow.setStorageEntry.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {hash} entry - Object containing storage entry (https://api.losant.com/#/definitions/flowStorageEntry)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Value was successfully stored (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if flow was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "flowId" in kwargs:
path_params["flowId"] = kwargs["flowId"]
if "entry" in kwargs:
body = kwargs["entry"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/flows/{flowId}/storage".format(**path_params)
return self.client.request("PATCH", path, params=query_params, headers=headers, body=body)
def stats(self, **kwargs):
"""
Get statistics about workflow runs for this workflow
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flow.*, or flow.stats.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {string} duration - Duration of time range in milliseconds
* {string} end - End of time range in milliseconds since epoch
* {string} resolution - Resolution in milliseconds
* {string} flowVersion - Flow version name or ID. When not included, will be aggregate for all versions. Pass develop for just the develop version.
* {string} deviceId - For edge or embedded workflows, the device ID to return workflow stats for. When not included, will be aggregate for all device IDs.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Statistics for workflow runs (https://api.losant.com/#/definitions/flowStats)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if flow was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "flowId" in kwargs:
path_params["flowId"] = kwargs["flowId"]
if "duration" in kwargs:
query_params["duration"] = kwargs["duration"]
if "end" in kwargs:
query_params["end"] = kwargs["end"]
if "resolution" in kwargs:
query_params["resolution"] = kwargs["resolution"]
if "flowVersion" in kwargs:
query_params["flowVersion"] = kwargs["flowVersion"]
if "deviceId" in kwargs:
query_params["deviceId"] = kwargs["deviceId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/flows/{flowId}/stats".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
|
class Flow(object):
''' Class containing all the actions for the Flow Resource '''
def __init__(self, client):
pass
def clear_storage_entries(self, **kwargs):
'''
Clear all storage entries
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, flow.*, or flow.clearStorageEntries.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - The current storage entries (https://api.losant.com/#/definitions/flowStorageEntries)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if flow was not found (https://api.losant.com/#/definitions/error)
'''
pass
def delete(self, **kwargs):
'''
Deletes a flow
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, flow.*, or flow.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If flow was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if flow was not found (https://api.losant.com/#/definitions/error)
'''
pass
def errors(self, **kwargs):
'''
Get information about errors that occurred during runs of this workflow
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flow.*, or flow.errors.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {string} duration - Duration of time range in milliseconds
* {string} end - End of time range in milliseconds since epoch
* {string} limit - Maximum number of errors to return
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} flowVersion - Flow version name or ID. When not included, will be errors for all versions. Pass develop for just the develop version.
* {string} deviceId - For edge or embedded workflows, the Device ID for which to return workflow errors. When not included, will be errors for all device IDs.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Workflow error information (https://api.losant.com/#/definitions/flowErrors)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if flow was not found (https://api.losant.com/#/definitions/error)
'''
pass
def get(self, **kwargs):
'''
Retrieves information on a flow
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flow.*, or flow.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {string} includeCustomNodes - If the result of the request should also include the details of any custom nodes referenced by the returned workflows
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Flow information (https://api.losant.com/#/definitions/flow)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if flow was not found (https://api.losant.com/#/definitions/error)
'''
pass
def get_log_entries(self, **kwargs):
'''
Retrieve the recent log entries about runs of this workflow
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flow.*, or flow.log.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {string} limit - Max log entries to return (ordered by time descending)
* {string} since - Look for log entries since this time (ms since epoch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Recent log entries (https://api.losant.com/#/definitions/flowLog)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if flow was not found (https://api.losant.com/#/definitions/error)
'''
pass
def get_storage_entries(self, **kwargs):
'''
Gets the current values in persistent storage
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flow.*, or flow.getStorageEntries.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - The current storage entries (https://api.losant.com/#/definitions/flowStorageEntries)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if flow was not found (https://api.losant.com/#/definitions/error)
'''
pass
def get_storage_entries_metadata(self, **kwargs):
'''
Gets metadata about storage for this flow
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flow.*, or flow.getStorageEntriesMetadata.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - The meta data for the current storage entries (https://api.losant.com/#/definitions/flowStorageMetadata)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if flow was not found (https://api.losant.com/#/definitions/error)
'''
pass
def patch(self, **kwargs):
'''
Updates information about a flow
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, flow.*, or flow.patch.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {string} includeCustomNodes - If the result of the request should also include the details of any custom nodes referenced by the returned workflows
* {hash} flow - Object containing new properties of the flow (https://api.losant.com/#/definitions/flowPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated flow information (https://api.losant.com/#/definitions/flow)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if flow is not found (https://api.losant.com/#/definitions/error)
'''
pass
def press_virtual_button(self, **kwargs):
'''
Presses the specified virtual button on the flow
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, flow.*, or flow.pressVirtualButton.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {hash} button - Object containing button key and payload (https://api.losant.com/#/definitions/virtualButtonPress)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Virtual button was pressed (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if flow was not found (https://api.losant.com/#/definitions/error)
'''
pass
def set_storage_entry(self, **kwargs):
'''
Sets a storage value
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, flow.*, or flow.setStorageEntry.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {hash} entry - Object containing storage entry (https://api.losant.com/#/definitions/flowStorageEntry)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Value was successfully stored (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if flow was not found (https://api.losant.com/#/definitions/error)
'''
pass
def stats(self, **kwargs):
'''
Get statistics about workflow runs for this workflow
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flow.*, or flow.stats.
Parameters:
* {string} applicationId - ID associated with the application
* {string} flowId - ID associated with the flow
* {string} duration - Duration of time range in milliseconds
* {string} end - End of time range in milliseconds since epoch
* {string} resolution - Resolution in milliseconds
* {string} flowVersion - Flow version name or ID. When not included, will be aggregate for all versions. Pass develop for just the develop version.
* {string} deviceId - For edge or embedded workflows, the device ID to return workflow stats for. When not included, will be aggregate for all device IDs.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Statistics for workflow runs (https://api.losant.com/#/definitions/flowStats)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if flow was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 13 | 12 | 48 | 7 | 21 | 20 | 8 | 0.96 | 1 | 0 | 0 | 0 | 12 | 1 | 12 | 12 | 587 | 100 | 248 | 69 | 235 | 239 | 248 | 69 | 235 | 13 | 1 | 1 | 96 |
147,200 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/file.py
|
platformrest.file.File
|
class File(object):
""" Class containing all the actions for the File Resource """
def __init__(self, client):
self.client = client
def delete(self, **kwargs):
"""
Deletes a file or directory, if directory all the contents that directory will also be removed.
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.cli, all.Organization, all.User, all.User.cli, file.*, or file.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} fileId - ID associated with the file
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If file was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if file was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "fileId" in kwargs:
path_params["fileId"] = kwargs["fileId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/file/{fileId}".format(**path_params)
return self.client.request("DELETE", path, params=query_params, headers=headers, body=body)
def get(self, **kwargs):
"""
Retrieves information on a file
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.cli, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.cli, all.User.read, file.*, or file.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} fileId - ID associated with the file
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - file information (https://api.losant.com/#/definitions/file)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if file was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "fileId" in kwargs:
path_params["fileId"] = kwargs["fileId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/file/{fileId}".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def move(self, **kwargs):
"""
Move a file or the entire contents of a directory
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.cli, all.Organization, all.User, all.User.cli, file.*, or file.move.
Parameters:
* {string} applicationId - ID associated with the application
* {string} fileId - ID associated with the file
* {undefined} name - The new name of the file or directory
* {undefined} parentDirectory - The new parent directory for the file or directory to move into.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Returns a new file or directory that was created by the move, if a directory a job will kick off to move all the directories children. (https://api.losant.com/#/definitions/file)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if file was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "fileId" in kwargs:
path_params["fileId"] = kwargs["fileId"]
if "name" in kwargs:
query_params["name"] = kwargs["name"]
if "parentDirectory" in kwargs:
query_params["parentDirectory"] = kwargs["parentDirectory"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/file/{fileId}/move".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
def patch(self, **kwargs):
"""
Reupload a file
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.cli, all.Organization, all.User, all.User.cli, file.*, or file.patch.
Parameters:
* {string} applicationId - ID associated with the application
* {string} fileId - ID associated with the file
* {hash} updates - Reupload a file (https://api.losant.com/#/definitions/filePatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully updated file and returned a post url to respond with (https://api.losant.com/#/definitions/fileUploadPostResponse)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if file was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "fileId" in kwargs:
path_params["fileId"] = kwargs["fileId"]
if "updates" in kwargs:
body = kwargs["updates"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/file/{fileId}".format(**path_params)
return self.client.request("PATCH", path, params=query_params, headers=headers, body=body)
|
class File(object):
''' Class containing all the actions for the File Resource '''
def __init__(self, client):
pass
def delete(self, **kwargs):
'''
Deletes a file or directory, if directory all the contents that directory will also be removed.
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.cli, all.Organization, all.User, all.User.cli, file.*, or file.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} fileId - ID associated with the file
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If file was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if file was not found (https://api.losant.com/#/definitions/error)
'''
pass
def get(self, **kwargs):
'''
Retrieves information on a file
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.cli, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.cli, all.User.read, file.*, or file.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} fileId - ID associated with the file
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - file information (https://api.losant.com/#/definitions/file)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if file was not found (https://api.losant.com/#/definitions/error)
'''
pass
def move(self, **kwargs):
'''
Move a file or the entire contents of a directory
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.cli, all.Organization, all.User, all.User.cli, file.*, or file.move.
Parameters:
* {string} applicationId - ID associated with the application
* {string} fileId - ID associated with the file
* {undefined} name - The new name of the file or directory
* {undefined} parentDirectory - The new parent directory for the file or directory to move into.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Returns a new file or directory that was created by the move, if a directory a job will kick off to move all the directories children. (https://api.losant.com/#/definitions/file)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if file was not found (https://api.losant.com/#/definitions/error)
'''
pass
def patch(self, **kwargs):
'''
Reupload a file
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.cli, all.Organization, all.User, all.User.cli, file.*, or file.patch.
Parameters:
* {string} applicationId - ID associated with the application
* {string} fileId - ID associated with the file
* {hash} updates - Reupload a file (https://api.losant.com/#/definitions/filePatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully updated file and returned a post url to respond with (https://api.losant.com/#/definitions/fileUploadPostResponse)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if file was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 6 | 5 | 40 | 6 | 17 | 17 | 6 | 0.99 | 1 | 0 | 0 | 0 | 5 | 1 | 5 | 5 | 206 | 37 | 85 | 27 | 79 | 84 | 85 | 27 | 79 | 9 | 1 | 1 | 32 |
147,201 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/experience_views.py
|
platformrest.experience_views.ExperienceViews
|
class ExperienceViews(object):
""" Class containing all the actions for the Experience Views Resource """
def __init__(self, client):
self.client = client
def get(self, **kwargs):
"""
Returns the experience views for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.cli, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.cli, all.User.read, experienceViews.*, or experienceViews.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} sortField - Field to sort the results by. Accepted values are: id, creationDate, name, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} viewType - Filter views to those only of the given type. Accepted values are: page, layout, component
* {string} version - Return the experience views belonging to this version
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of experience views (https://api.losant.com/#/definitions/experienceViews)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "sortField" in kwargs:
query_params["sortField"] = kwargs["sortField"]
if "sortDirection" in kwargs:
query_params["sortDirection"] = kwargs["sortDirection"]
if "page" in kwargs:
query_params["page"] = kwargs["page"]
if "perPage" in kwargs:
query_params["perPage"] = kwargs["perPage"]
if "filterField" in kwargs:
query_params["filterField"] = kwargs["filterField"]
if "filter" in kwargs:
query_params["filter"] = kwargs["filter"]
if "viewType" in kwargs:
query_params["viewType"] = kwargs["viewType"]
if "version" in kwargs:
query_params["version"] = kwargs["version"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/views".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def post(self, **kwargs):
"""
Create a new experience view for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.cli, all.Organization, all.User, all.User.cli, experienceViews.*, or experienceViews.post.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} experienceView - New experience view information (https://api.losant.com/#/definitions/experienceViewPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created experience view (https://api.losant.com/#/definitions/experienceView)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "experienceView" in kwargs:
body = kwargs["experienceView"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/views".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
|
class ExperienceViews(object):
''' Class containing all the actions for the Experience Views Resource '''
def __init__(self, client):
pass
def get(self, **kwargs):
'''
Returns the experience views for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.cli, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.cli, all.User.read, experienceViews.*, or experienceViews.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} sortField - Field to sort the results by. Accepted values are: id, creationDate, name, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} viewType - Filter views to those only of the given type. Accepted values are: page, layout, component
* {string} version - Return the experience views belonging to this version
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of experience views (https://api.losant.com/#/definitions/experienceViews)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
def post(self, **kwargs):
'''
Create a new experience view for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.cli, all.Organization, all.User, all.User.cli, experienceViews.*, or experienceViews.post.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} experienceView - New experience view information (https://api.losant.com/#/definitions/experienceViewPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created experience view (https://api.losant.com/#/definitions/experienceView)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 4 | 3 | 39 | 5 | 18 | 16 | 7 | 0.87 | 1 | 0 | 0 | 0 | 3 | 1 | 3 | 3 | 122 | 19 | 55 | 15 | 51 | 48 | 55 | 15 | 51 | 14 | 1 | 1 | 22 |
147,202 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/experience_endpoints.py
|
platformrest.experience_endpoints.ExperienceEndpoints
|
class ExperienceEndpoints(object):
""" Class containing all the actions for the Experience Endpoints Resource """
def __init__(self, client):
self.client = client
def get(self, **kwargs):
"""
Returns the experience endpoints for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, experienceEndpoints.*, or experienceEndpoints.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} sortField - Field to sort the results by. Accepted values are: order, method, route, id, creationDate, requestCount, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: method, route
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} experienceGroupId - Filter endpoints to those only in the specified group
* {string} requestCountDuration - If set, a count of recent requests is included on each endpoint for the duration requested (milliseconds)
* {string} version - Return the experience endpoints belonging to this version
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of experience endpoints (https://api.losant.com/#/definitions/experienceEndpoints)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "sortField" in kwargs:
query_params["sortField"] = kwargs["sortField"]
if "sortDirection" in kwargs:
query_params["sortDirection"] = kwargs["sortDirection"]
if "filterField" in kwargs:
query_params["filterField"] = kwargs["filterField"]
if "filter" in kwargs:
query_params["filter"] = kwargs["filter"]
if "experienceGroupId" in kwargs:
query_params["experienceGroupId"] = kwargs["experienceGroupId"]
if "requestCountDuration" in kwargs:
query_params["requestCountDuration"] = kwargs["requestCountDuration"]
if "version" in kwargs:
query_params["version"] = kwargs["version"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/endpoints".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def post(self, **kwargs):
"""
Create a new experience endpoint for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, experienceEndpoints.*, or experienceEndpoints.post.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} experienceEndpoint - New experience endpoint information (https://api.losant.com/#/definitions/experienceEndpointPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created experience endpoint (https://api.losant.com/#/definitions/experienceEndpoint)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "experienceEndpoint" in kwargs:
body = kwargs["experienceEndpoint"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/endpoints".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
def stats(self, **kwargs):
"""
Get statistics about endpoint requests
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, experienceEndpoints.*, or experienceEndpoints.stats.
Parameters:
* {string} applicationId - ID associated with the application
* {string} statGrouping - Field to group the statistics by. Accepted values are: statusCode, endpointId, version, domain
* {string} duration - Duration in milliseconds
* {string} end - End of time range in milliseconds since epoch
* {string} resolution - Resolution in milliseconds
* {string} versionFilter - Filters the stats to a particular experience version
* {string} domainFilter - Filters the stats to a particular experience domain or slug
* {string} statusCodeFilter - Filters the stats to a particular status code
* {string} endpointIdFilter - Filters the stats to a particular endpoint
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Statistics for endpoint requests (https://api.losant.com/#/definitions/experienceEndpointStats)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "statGrouping" in kwargs:
query_params["statGrouping"] = kwargs["statGrouping"]
if "duration" in kwargs:
query_params["duration"] = kwargs["duration"]
if "end" in kwargs:
query_params["end"] = kwargs["end"]
if "resolution" in kwargs:
query_params["resolution"] = kwargs["resolution"]
if "versionFilter" in kwargs:
query_params["versionFilter"] = kwargs["versionFilter"]
if "domainFilter" in kwargs:
query_params["domainFilter"] = kwargs["domainFilter"]
if "statusCodeFilter" in kwargs:
query_params["statusCodeFilter"] = kwargs["statusCodeFilter"]
if "endpointIdFilter" in kwargs:
query_params["endpointIdFilter"] = kwargs["endpointIdFilter"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/endpoints/stats".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
|
class ExperienceEndpoints(object):
''' Class containing all the actions for the Experience Endpoints Resource '''
def __init__(self, client):
pass
def get(self, **kwargs):
'''
Returns the experience endpoints for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, experienceEndpoints.*, or experienceEndpoints.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} sortField - Field to sort the results by. Accepted values are: order, method, route, id, creationDate, requestCount, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: method, route
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} experienceGroupId - Filter endpoints to those only in the specified group
* {string} requestCountDuration - If set, a count of recent requests is included on each endpoint for the duration requested (milliseconds)
* {string} version - Return the experience endpoints belonging to this version
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of experience endpoints (https://api.losant.com/#/definitions/experienceEndpoints)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
def post(self, **kwargs):
'''
Create a new experience endpoint for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, experienceEndpoints.*, or experienceEndpoints.post.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} experienceEndpoint - New experience endpoint information (https://api.losant.com/#/definitions/experienceEndpointPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created experience endpoint (https://api.losant.com/#/definitions/experienceEndpoint)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
def stats(self, **kwargs):
'''
Get statistics about endpoint requests
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, experienceEndpoints.*, or experienceEndpoints.stats.
Parameters:
* {string} applicationId - ID associated with the application
* {string} statGrouping - Field to group the statistics by. Accepted values are: statusCode, endpointId, version, domain
* {string} duration - Duration in milliseconds
* {string} end - End of time range in milliseconds since epoch
* {string} resolution - Resolution in milliseconds
* {string} versionFilter - Filters the stats to a particular experience version
* {string} domainFilter - Filters the stats to a particular experience domain or slug
* {string} statusCodeFilter - Filters the stats to a particular status code
* {string} endpointIdFilter - Filters the stats to a particular endpoint
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Statistics for endpoint requests (https://api.losant.com/#/definitions/experienceEndpointStats)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 5 | 4 | 46 | 6 | 21 | 18 | 9 | 0.86 | 1 | 0 | 0 | 0 | 4 | 1 | 4 | 4 | 188 | 28 | 86 | 21 | 81 | 74 | 86 | 21 | 81 | 14 | 1 | 1 | 35 |
147,203 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/experience_view.py
|
platformrest.experience_view.ExperienceView
|
class ExperienceView(object):
""" Class containing all the actions for the Experience View Resource """
def __init__(self, client):
self.client = client
def delete(self, **kwargs):
"""
Deletes an experience view
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.cli, all.Organization, all.User, all.User.cli, experienceView.*, or experienceView.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceViewId - ID associated with the experience view
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If experience view was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience view was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "experienceViewId" in kwargs:
path_params["experienceViewId"] = kwargs["experienceViewId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/views/{experienceViewId}".format(**path_params)
return self.client.request("DELETE", path, params=query_params, headers=headers, body=body)
def get(self, **kwargs):
"""
Retrieves information on an experience view
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.cli, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.cli, all.User.read, experienceView.*, or experienceView.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceViewId - ID associated with the experience view
* {string} version - Version of this experience view to return
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Experience view information (https://api.losant.com/#/definitions/experienceView)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience view was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "experienceViewId" in kwargs:
path_params["experienceViewId"] = kwargs["experienceViewId"]
if "version" in kwargs:
query_params["version"] = kwargs["version"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/views/{experienceViewId}".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def linked_resources(self, **kwargs):
"""
Retrieves information on resources linked to an experience view
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.cli, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.cli, all.User.read, experienceView.*, or experienceView.linkedResources.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceViewId - ID associated with the experience view
* {string} version - Version of this experience view to query
* {string} includeCustomNodes - If the result of the request should also include the details of any custom nodes referenced by returned workflows
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Linked resource information (https://api.losant.com/#/definitions/experienceLinkedResources)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience view was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "experienceViewId" in kwargs:
path_params["experienceViewId"] = kwargs["experienceViewId"]
if "version" in kwargs:
query_params["version"] = kwargs["version"]
if "includeCustomNodes" in kwargs:
query_params["includeCustomNodes"] = kwargs["includeCustomNodes"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/views/{experienceViewId}/linkedResources".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def patch(self, **kwargs):
"""
Updates information about an experience view
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.cli, all.Organization, all.User, all.User.cli, experienceView.*, or experienceView.patch.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceViewId - ID associated with the experience view
* {hash} experienceView - Object containing new properties of the experience view (https://api.losant.com/#/definitions/experienceViewPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated experience view information (https://api.losant.com/#/definitions/experienceView)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience view was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "experienceViewId" in kwargs:
path_params["experienceViewId"] = kwargs["experienceViewId"]
if "experienceView" in kwargs:
body = kwargs["experienceView"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/views/{experienceViewId}".format(**path_params)
return self.client.request("PATCH", path, params=query_params, headers=headers, body=body)
|
class ExperienceView(object):
''' Class containing all the actions for the Experience View Resource '''
def __init__(self, client):
pass
def delete(self, **kwargs):
'''
Deletes an experience view
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.cli, all.Organization, all.User, all.User.cli, experienceView.*, or experienceView.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceViewId - ID associated with the experience view
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If experience view was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience view was not found (https://api.losant.com/#/definitions/error)
'''
pass
def get(self, **kwargs):
'''
Retrieves information on an experience view
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.cli, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.cli, all.User.read, experienceView.*, or experienceView.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceViewId - ID associated with the experience view
* {string} version - Version of this experience view to return
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Experience view information (https://api.losant.com/#/definitions/experienceView)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience view was not found (https://api.losant.com/#/definitions/error)
'''
pass
def linked_resources(self, **kwargs):
'''
Retrieves information on resources linked to an experience view
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.cli, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.cli, all.User.read, experienceView.*, or experienceView.linkedResources.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceViewId - ID associated with the experience view
* {string} version - Version of this experience view to query
* {string} includeCustomNodes - If the result of the request should also include the details of any custom nodes referenced by returned workflows
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Linked resource information (https://api.losant.com/#/definitions/experienceLinkedResources)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience view was not found (https://api.losant.com/#/definitions/error)
'''
pass
def patch(self, **kwargs):
'''
Updates information about an experience view
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.cli, all.Organization, all.User, all.User.cli, experienceView.*, or experienceView.patch.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceViewId - ID associated with the experience view
* {hash} experienceView - Object containing new properties of the experience view (https://api.losant.com/#/definitions/experienceViewPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated experience view information (https://api.losant.com/#/definitions/experienceView)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience view was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 6 | 5 | 40 | 6 | 17 | 17 | 7 | 0.98 | 1 | 0 | 0 | 0 | 5 | 1 | 5 | 5 | 209 | 37 | 87 | 27 | 81 | 85 | 87 | 27 | 81 | 9 | 1 | 1 | 33 |
147,204 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/experience_version.py
|
platformrest.experience_version.ExperienceVersion
|
class ExperienceVersion(object):
""" Class containing all the actions for the Experience Version Resource """
def __init__(self, client):
self.client = client
def delete(self, **kwargs):
"""
Deletes an experience version
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.cli, all.Organization, all.User, all.User.cli, experienceVersion.*, or experienceVersion.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceVersionIdOrName - Version ID or version name associated with the experience version
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If experience version was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience version was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "experienceVersionIdOrName" in kwargs:
path_params["experienceVersionIdOrName"] = kwargs["experienceVersionIdOrName"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/versions/{experienceVersionIdOrName}".format(**path_params)
return self.client.request("DELETE", path, params=query_params, headers=headers, body=body)
def get(self, **kwargs):
"""
Retrieves information on an experience version
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.cli, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.cli, all.User.read, experienceVersion.*, or experienceVersion.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceVersionIdOrName - Version ID or version name associated with the experience version
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Experience version information (https://api.losant.com/#/definitions/experienceVersion)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience version was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "experienceVersionIdOrName" in kwargs:
path_params["experienceVersionIdOrName"] = kwargs["experienceVersionIdOrName"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/versions/{experienceVersionIdOrName}".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def patch(self, **kwargs):
"""
Updates information about an experience version
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.cli, all.Organization, all.User, all.User.cli, experienceVersion.*, or experienceVersion.patch.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceVersionIdOrName - Version ID or version name associated with the experience version
* {hash} experienceVersion - Object containing new properties of the experience version (https://api.losant.com/#/definitions/experienceVersionPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated experience version information (https://api.losant.com/#/definitions/experienceVersion)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience version was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "experienceVersionIdOrName" in kwargs:
path_params["experienceVersionIdOrName"] = kwargs["experienceVersionIdOrName"]
if "experienceVersion" in kwargs:
body = kwargs["experienceVersion"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/versions/{experienceVersionIdOrName}".format(**path_params)
return self.client.request("PATCH", path, params=query_params, headers=headers, body=body)
|
class ExperienceVersion(object):
''' Class containing all the actions for the Experience Version Resource '''
def __init__(self, client):
pass
def delete(self, **kwargs):
'''
Deletes an experience version
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.cli, all.Organization, all.User, all.User.cli, experienceVersion.*, or experienceVersion.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceVersionIdOrName - Version ID or version name associated with the experience version
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If experience version was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience version was not found (https://api.losant.com/#/definitions/error)
'''
pass
def get(self, **kwargs):
'''
Retrieves information on an experience version
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.cli, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.cli, all.User.read, experienceVersion.*, or experienceVersion.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceVersionIdOrName - Version ID or version name associated with the experience version
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Experience version information (https://api.losant.com/#/definitions/experienceVersion)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience version was not found (https://api.losant.com/#/definitions/error)
'''
pass
def patch(self, **kwargs):
'''
Updates information about an experience version
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.cli, all.Organization, all.User, all.User.cli, experienceVersion.*, or experienceVersion.patch.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceVersionIdOrName - Version ID or version name associated with the experience version
* {hash} experienceVersion - Object containing new properties of the experience version (https://api.losant.com/#/definitions/experienceVersionPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated experience version information (https://api.losant.com/#/definitions/experienceVersion)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience version was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 5 | 4 | 37 | 6 | 15 | 15 | 6 | 1 | 1 | 0 | 0 | 0 | 4 | 1 | 4 | 4 | 152 | 28 | 62 | 21 | 57 | 62 | 62 | 21 | 57 | 8 | 1 | 1 | 23 |
147,205 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/experience_users.py
|
platformrest.experience_users.ExperienceUsers
|
class ExperienceUsers(object):
""" Class containing all the actions for the Experience Users Resource """
def __init__(self, client):
self.client = client
def get(self, **kwargs):
"""
Returns the experience users for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, experienceUsers.*, or experienceUsers.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} sortField - Field to sort the results by. Accepted values are: firstName, lastName, email, id, creationDate, lastLogin, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: firstName, lastName, email
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} experienceGroupId - Filter users to those only in the specified group, special experienceGroupIds of 'any' which will give users who are in at least one group and 'none' will give you users who are not in any groups.
* {string} includeAncestorGroups - If set will include members from ancestors of the specified experienceGroupId
* {hash} query - Experience user filter JSON object which overrides all other filter params. (https://api.losant.com/#/definitions/advancedExperienceUserQuery)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of experience users (https://api.losant.com/#/definitions/experienceUsers)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "sortField" in kwargs:
query_params["sortField"] = kwargs["sortField"]
if "sortDirection" in kwargs:
query_params["sortDirection"] = kwargs["sortDirection"]
if "page" in kwargs:
query_params["page"] = kwargs["page"]
if "perPage" in kwargs:
query_params["perPage"] = kwargs["perPage"]
if "filterField" in kwargs:
query_params["filterField"] = kwargs["filterField"]
if "filter" in kwargs:
query_params["filter"] = kwargs["filter"]
if "experienceGroupId" in kwargs:
query_params["experienceGroupId"] = kwargs["experienceGroupId"]
if "includeAncestorGroups" in kwargs:
query_params["includeAncestorGroups"] = kwargs["includeAncestorGroups"]
if "query" in kwargs:
query_params["query"] = json.dumps(kwargs["query"])
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/users".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def post(self, **kwargs):
"""
Create a new experience user for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, experienceUsers.*, or experienceUsers.post.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} experienceUser - New experience user information (https://api.losant.com/#/definitions/experienceUserPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created experience user (https://api.losant.com/#/definitions/experienceUser)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "experienceUser" in kwargs:
body = kwargs["experienceUser"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/users".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
|
class ExperienceUsers(object):
''' Class containing all the actions for the Experience Users Resource '''
def __init__(self, client):
pass
def get(self, **kwargs):
'''
Returns the experience users for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, experienceUsers.*, or experienceUsers.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} sortField - Field to sort the results by. Accepted values are: firstName, lastName, email, id, creationDate, lastLogin, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: firstName, lastName, email
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} experienceGroupId - Filter users to those only in the specified group, special experienceGroupIds of 'any' which will give users who are in at least one group and 'none' will give you users who are not in any groups.
* {string} includeAncestorGroups - If set will include members from ancestors of the specified experienceGroupId
* {hash} query - Experience user filter JSON object which overrides all other filter params. (https://api.losant.com/#/definitions/advancedExperienceUserQuery)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of experience users (https://api.losant.com/#/definitions/experienceUsers)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
def post(self, **kwargs):
'''
Create a new experience user for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, experienceUsers.*, or experienceUsers.post.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} experienceUser - New experience user information (https://api.losant.com/#/definitions/experienceUserPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created experience user (https://api.losant.com/#/definitions/experienceUser)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 4 | 3 | 40 | 5 | 19 | 16 | 8 | 0.86 | 1 | 0 | 0 | 0 | 3 | 1 | 3 | 3 | 125 | 19 | 57 | 15 | 53 | 49 | 57 | 15 | 53 | 15 | 1 | 1 | 23 |
147,206 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/auth.py
|
platformrest.auth.Auth
|
class Auth(object):
""" Class containing all the actions for the Auth Resource """
def __init__(self, client):
self.client = client
def authenticate_device(self, **kwargs):
"""
Authenticates a device using the provided credentials.
Authentication:
No api access token is required to call this action.
Parameters:
* {hash} credentials - Device authentication credentials (https://api.losant.com/#/definitions/deviceCredentials)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Successful authentication. The included api access token by default has the scope 'all.Device'. (https://api.losant.com/#/definitions/authedDevice)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 401 - Unauthorized error if authentication fails (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "credentials" in kwargs:
body = kwargs["credentials"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/auth/device".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
def authenticate_user(self, **kwargs):
"""
Authenticates a user using the provided credentials.
Authentication:
No api access token is required to call this action.
Parameters:
* {hash} credentials - User authentication credentials (https://api.losant.com/#/definitions/userCredentials)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Successful authentication. The included api access token has the scope 'all.User'. (https://api.losant.com/#/definitions/authedUser)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 401 - Unauthorized error if authentication fails (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "credentials" in kwargs:
body = kwargs["credentials"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/auth/user".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
def authenticate_user_github(self, **kwargs):
"""
Authenticates a user via GitHub OAuth.
Authentication:
No api access token is required to call this action.
Parameters:
* {hash} oauth - User authentication credentials (access token) (https://api.losant.com/#/definitions/githubLogin)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Successful authentication. The included api access token has the scope 'all.User'. (https://api.losant.com/#/definitions/authedUser)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 401 - Unauthorized error if authentication fails (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "oauth" in kwargs:
body = kwargs["oauth"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/auth/user/github".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
def authenticate_user_saml(self, **kwargs):
"""
Authenticates a user via a SAML response.
Authentication:
No api access token is required to call this action.
Parameters:
* {hash} saml - Encoded SAML response from an IDP for a user. (https://api.losant.com/#/definitions/samlResponse)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Successful authentication. The included api access token has the scope 'all.User'. (https://api.losant.com/#/definitions/authedUser)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 401 - Unauthorized error if authentication fails (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "saml" in kwargs:
body = kwargs["saml"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/auth/user/saml".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
def sso_domain(self, **kwargs):
"""
Checks email domain for SSO configuration.
Authentication:
No api access token is required to call this action.
Parameters:
* {string} email - The email address associated with the user login
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Successful finding SSO for domain. Returns SSO request URL and type. (https://api.losant.com/#/definitions/ssoRequest)
* 204 - No domain associated with an SSO configuration
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "email" in kwargs:
query_params["email"] = kwargs["email"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/auth/ssoDomain".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
|
class Auth(object):
''' Class containing all the actions for the Auth Resource '''
def __init__(self, client):
pass
def authenticate_device(self, **kwargs):
'''
Authenticates a device using the provided credentials.
Authentication:
No api access token is required to call this action.
Parameters:
* {hash} credentials - Device authentication credentials (https://api.losant.com/#/definitions/deviceCredentials)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Successful authentication. The included api access token by default has the scope 'all.Device'. (https://api.losant.com/#/definitions/authedDevice)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 401 - Unauthorized error if authentication fails (https://api.losant.com/#/definitions/error)
'''
pass
def authenticate_user(self, **kwargs):
'''
Authenticates a user using the provided credentials.
Authentication:
No api access token is required to call this action.
Parameters:
* {hash} credentials - User authentication credentials (https://api.losant.com/#/definitions/userCredentials)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Successful authentication. The included api access token has the scope 'all.User'. (https://api.losant.com/#/definitions/authedUser)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 401 - Unauthorized error if authentication fails (https://api.losant.com/#/definitions/error)
'''
pass
def authenticate_user_github(self, **kwargs):
'''
Authenticates a user via GitHub OAuth.
Authentication:
No api access token is required to call this action.
Parameters:
* {hash} oauth - User authentication credentials (access token) (https://api.losant.com/#/definitions/githubLogin)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Successful authentication. The included api access token has the scope 'all.User'. (https://api.losant.com/#/definitions/authedUser)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 401 - Unauthorized error if authentication fails (https://api.losant.com/#/definitions/error)
'''
pass
def authenticate_user_saml(self, **kwargs):
'''
Authenticates a user via a SAML response.
Authentication:
No api access token is required to call this action.
Parameters:
* {hash} saml - Encoded SAML response from an IDP for a user. (https://api.losant.com/#/definitions/samlResponse)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Successful authentication. The included api access token has the scope 'all.User'. (https://api.losant.com/#/definitions/authedUser)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 401 - Unauthorized error if authentication fails (https://api.losant.com/#/definitions/error)
'''
pass
def sso_domain(self, **kwargs):
'''
Checks email domain for SSO configuration.
Authentication:
No api access token is required to call this action.
Parameters:
* {string} email - The email address associated with the user login
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Successful finding SSO for domain. Returns SSO request URL and type. (https://api.losant.com/#/definitions/ssoRequest)
* 204 - No domain associated with an SSO configuration
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
'''
pass
| 7 | 6 | 35 | 7 | 15 | 13 | 5 | 0.92 | 1 | 0 | 0 | 0 | 6 | 1 | 6 | 6 | 215 | 46 | 88 | 33 | 81 | 81 | 88 | 33 | 81 | 6 | 1 | 1 | 31 |
147,207 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/experience_slugs.py
|
platformrest.experience_slugs.ExperienceSlugs
|
class ExperienceSlugs(object):
""" Class containing all the actions for the Experience Slugs Resource """
def __init__(self, client):
self.client = client
def get(self, **kwargs):
"""
Returns the experience slugs for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.cli, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.cli, all.User.read, experienceSlugs.*, or experienceSlugs.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of experience slugs (https://api.losant.com/#/definitions/experienceSlugs)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/slugs".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def post(self, **kwargs):
"""
Create a new experience slug for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, experienceSlugs.*, or experienceSlugs.post.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} experienceSlug - New experience slug information (https://api.losant.com/#/definitions/experienceSlugPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created experience slug (https://api.losant.com/#/definitions/experienceSlug)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "experienceSlug" in kwargs:
body = kwargs["experienceSlug"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/slugs".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
|
class ExperienceSlugs(object):
''' Class containing all the actions for the Experience Slugs Resource '''
def __init__(self, client):
pass
def get(self, **kwargs):
'''
Returns the experience slugs for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.cli, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.cli, all.User.read, experienceSlugs.*, or experienceSlugs.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of experience slugs (https://api.losant.com/#/definitions/experienceSlugs)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
def post(self, **kwargs):
'''
Create a new experience slug for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, experienceSlugs.*, or experienceSlugs.post.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} experienceSlug - New experience slug information (https://api.losant.com/#/definitions/experienceSlugPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created experience slug (https://api.losant.com/#/definitions/experienceSlug)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 4 | 3 | 31 | 5 | 13 | 13 | 5 | 1.03 | 1 | 0 | 0 | 0 | 3 | 1 | 3 | 3 | 98 | 19 | 39 | 15 | 35 | 40 | 39 | 15 | 35 | 7 | 1 | 1 | 14 |
147,208 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/experience_slug.py
|
platformrest.experience_slug.ExperienceSlug
|
class ExperienceSlug(object):
""" Class containing all the actions for the Experience Slug Resource """
def __init__(self, client):
self.client = client
def delete(self, **kwargs):
"""
Deletes an experience slug
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, experienceSlug.*, or experienceSlug.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceSlugId - ID associated with the experience slug
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If experience slug was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience slug was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "experienceSlugId" in kwargs:
path_params["experienceSlugId"] = kwargs["experienceSlugId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/slugs/{experienceSlugId}".format(**path_params)
return self.client.request("DELETE", path, params=query_params, headers=headers, body=body)
def get(self, **kwargs):
"""
Retrieves information on an experience slug
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, experienceSlug.*, or experienceSlug.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceSlugId - ID associated with the experience slug
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Experience slug information (https://api.losant.com/#/definitions/experienceSlug)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience slug was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "experienceSlugId" in kwargs:
path_params["experienceSlugId"] = kwargs["experienceSlugId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/slugs/{experienceSlugId}".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def patch(self, **kwargs):
"""
Updates information about an experience slug
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, experienceSlug.*, or experienceSlug.patch.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceSlugId - ID associated with the experience slug
* {hash} experienceSlug - Object containing new properties of the experience slug (https://api.losant.com/#/definitions/experienceSlugPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated experience slug information (https://api.losant.com/#/definitions/experienceSlug)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience slug was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "experienceSlugId" in kwargs:
path_params["experienceSlugId"] = kwargs["experienceSlugId"]
if "experienceSlug" in kwargs:
body = kwargs["experienceSlug"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/slugs/{experienceSlugId}".format(**path_params)
return self.client.request("PATCH", path, params=query_params, headers=headers, body=body)
|
class ExperienceSlug(object):
''' Class containing all the actions for the Experience Slug Resource '''
def __init__(self, client):
pass
def delete(self, **kwargs):
'''
Deletes an experience slug
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, experienceSlug.*, or experienceSlug.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceSlugId - ID associated with the experience slug
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If experience slug was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience slug was not found (https://api.losant.com/#/definitions/error)
'''
pass
def get(self, **kwargs):
'''
Retrieves information on an experience slug
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, experienceSlug.*, or experienceSlug.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceSlugId - ID associated with the experience slug
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Experience slug information (https://api.losant.com/#/definitions/experienceSlug)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience slug was not found (https://api.losant.com/#/definitions/error)
'''
pass
def patch(self, **kwargs):
'''
Updates information about an experience slug
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, experienceSlug.*, or experienceSlug.patch.
Parameters:
* {string} applicationId - ID associated with the application
* {string} experienceSlugId - ID associated with the experience slug
* {hash} experienceSlug - Object containing new properties of the experience slug (https://api.losant.com/#/definitions/experienceSlugPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated experience slug information (https://api.losant.com/#/definitions/experienceSlug)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if experience slug was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 5 | 4 | 37 | 6 | 15 | 15 | 6 | 1 | 1 | 0 | 0 | 0 | 4 | 1 | 4 | 4 | 152 | 28 | 62 | 21 | 57 | 62 | 62 | 21 | 57 | 8 | 1 | 1 | 23 |
147,209 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/experience_groups.py
|
platformrest.experience_groups.ExperienceGroups
|
class ExperienceGroups(object):
""" Class containing all the actions for the Experience Groups Resource """
def __init__(self, client):
self.client = client
def get(self, **kwargs):
"""
Returns the experience groups for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, experienceGroups.*, or experienceGroups.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {hash} query - Experience group filter JSON object which overrides the filter and filterField fields. (https://api.losant.com/#/definitions/advancedExperienceGroupQuery)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of experience groups (https://api.losant.com/#/definitions/experienceGroups)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "sortField" in kwargs:
query_params["sortField"] = kwargs["sortField"]
if "sortDirection" in kwargs:
query_params["sortDirection"] = kwargs["sortDirection"]
if "page" in kwargs:
query_params["page"] = kwargs["page"]
if "perPage" in kwargs:
query_params["perPage"] = kwargs["perPage"]
if "filterField" in kwargs:
query_params["filterField"] = kwargs["filterField"]
if "filter" in kwargs:
query_params["filter"] = kwargs["filter"]
if "query" in kwargs:
query_params["query"] = json.dumps(kwargs["query"])
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/groups".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def post(self, **kwargs):
"""
Create a new experience group for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, experienceGroups.*, or experienceGroups.post.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} experienceGroup - New experience group information (https://api.losant.com/#/definitions/experienceGroupPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created experience group (https://api.losant.com/#/definitions/experienceGroup)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "experienceGroup" in kwargs:
body = kwargs["experienceGroup"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/groups".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
|
class ExperienceGroups(object):
''' Class containing all the actions for the Experience Groups Resource '''
def __init__(self, client):
pass
def get(self, **kwargs):
'''
Returns the experience groups for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, experienceGroups.*, or experienceGroups.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {hash} query - Experience group filter JSON object which overrides the filter and filterField fields. (https://api.losant.com/#/definitions/advancedExperienceGroupQuery)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of experience groups (https://api.losant.com/#/definitions/experienceGroups)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
def post(self, **kwargs):
'''
Create a new experience group for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, experienceGroups.*, or experienceGroups.post.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} experienceGroup - New experience group information (https://api.losant.com/#/definitions/experienceGroupPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created experience group (https://api.losant.com/#/definitions/experienceGroup)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 4 | 3 | 38 | 5 | 17 | 15 | 7 | 0.89 | 1 | 0 | 0 | 0 | 3 | 1 | 3 | 3 | 119 | 19 | 53 | 15 | 49 | 47 | 53 | 15 | 49 | 13 | 1 | 1 | 21 |
147,210 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/experience_versions.py
|
platformrest.experience_versions.ExperienceVersions
|
class ExperienceVersions(object):
""" Class containing all the actions for the Experience Versions Resource """
def __init__(self, client):
self.client = client
def get(self, **kwargs):
"""
Returns the experience versions for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.cli, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.cli, all.User.read, experienceVersions.*, or experienceVersions.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} sortField - Field to sort the results by. Accepted values are: version, id, creationDate, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: version
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of experience versions (https://api.losant.com/#/definitions/experienceVersions)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "sortField" in kwargs:
query_params["sortField"] = kwargs["sortField"]
if "sortDirection" in kwargs:
query_params["sortDirection"] = kwargs["sortDirection"]
if "page" in kwargs:
query_params["page"] = kwargs["page"]
if "perPage" in kwargs:
query_params["perPage"] = kwargs["perPage"]
if "filterField" in kwargs:
query_params["filterField"] = kwargs["filterField"]
if "filter" in kwargs:
query_params["filter"] = kwargs["filter"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/versions".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def post(self, **kwargs):
"""
Create a new experience version for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.cli, all.Organization, all.User, all.User.cli, experienceVersions.*, or experienceVersions.post.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} experienceVersion - New experience version information (https://api.losant.com/#/definitions/experienceVersionPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created experience version (https://api.losant.com/#/definitions/experienceVersion)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "experienceVersion" in kwargs:
body = kwargs["experienceVersion"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/experience/versions".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
|
class ExperienceVersions(object):
''' Class containing all the actions for the Experience Versions Resource '''
def __init__(self, client):
pass
def get(self, **kwargs):
'''
Returns the experience versions for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.cli, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.cli, all.User.read, experienceVersions.*, or experienceVersions.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} sortField - Field to sort the results by. Accepted values are: version, id, creationDate, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: version
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of experience versions (https://api.losant.com/#/definitions/experienceVersions)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
def post(self, **kwargs):
'''
Create a new experience version for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.cli, all.Organization, all.User, all.User.cli, experienceVersions.*, or experienceVersions.post.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} experienceVersion - New experience version information (https://api.losant.com/#/definitions/experienceVersionPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created experience version (https://api.losant.com/#/definitions/experienceVersion)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 4 | 3 | 37 | 5 | 17 | 15 | 7 | 0.9 | 1 | 0 | 0 | 0 | 3 | 1 | 3 | 3 | 116 | 19 | 51 | 15 | 47 | 46 | 51 | 15 | 47 | 12 | 1 | 1 | 20 |
147,211 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/audit_logs.py
|
platformrest.audit_logs.AuditLogs
|
class AuditLogs(object):
""" Class containing all the actions for the Audit Logs Resource """
def __init__(self, client):
self.client = client
def get(self, **kwargs):
"""
Returns the audit logs for the organization
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.Organization.read, all.User, all.User.read, auditLogs.*, or auditLogs.get.
Parameters:
* {string} orgId - ID associated with the organization
* {string} sortField - Field to sort the results by. Accepted values are: creationDate, responseStatus, actorName
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} start - Start of time range for audit log query
* {string} end - End of time range for audit log query
* {hash} auditLogFilter - Filters for the audit log query (https://api.losant.com/#/definitions/auditLogFilter)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of audit logs (https://api.losant.com/#/definitions/auditLogs)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if organization was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "orgId" in kwargs:
path_params["orgId"] = kwargs["orgId"]
if "sortField" in kwargs:
query_params["sortField"] = kwargs["sortField"]
if "sortDirection" in kwargs:
query_params["sortDirection"] = kwargs["sortDirection"]
if "page" in kwargs:
query_params["page"] = kwargs["page"]
if "perPage" in kwargs:
query_params["perPage"] = kwargs["perPage"]
if "start" in kwargs:
query_params["start"] = kwargs["start"]
if "end" in kwargs:
query_params["end"] = kwargs["end"]
if "auditLogFilter" in kwargs:
query_params["auditLogFilter"] = kwargs["auditLogFilter"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/orgs/{orgId}/audit-logs".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
|
class AuditLogs(object):
''' Class containing all the actions for the Audit Logs Resource '''
def __init__(self, client):
pass
def get(self, **kwargs):
'''
Returns the audit logs for the organization
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.Organization.read, all.User, all.User.read, auditLogs.*, or auditLogs.get.
Parameters:
* {string} orgId - ID associated with the organization
* {string} sortField - Field to sort the results by. Accepted values are: creationDate, responseStatus, actorName
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} start - Start of time range for audit log query
* {string} end - End of time range for audit log query
* {hash} auditLogFilter - Filters for the audit log query (https://api.losant.com/#/definitions/auditLogFilter)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of audit logs (https://api.losant.com/#/definitions/auditLogs)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if organization was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 3 | 2 | 34 | 4 | 17 | 13 | 7 | 0.79 | 1 | 0 | 0 | 0 | 2 | 1 | 2 | 2 | 71 | 10 | 34 | 9 | 31 | 27 | 34 | 9 | 31 | 13 | 1 | 1 | 14 |
147,212 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/me.py
|
platformrest.me.Me
|
class Me(object):
""" Class containing all the actions for the Me Resource """
def __init__(self, client):
self.client = client
def add_recent_item(self, **kwargs):
"""
Adds an item to a recent item list
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, me.*, or me.addRecentItem.
Parameters:
* {hash} data - Object containing recent item info (https://api.losant.com/#/definitions/recentItem)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated recent item list (https://api.losant.com/#/definitions/recentItemList)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "data" in kwargs:
body = kwargs["data"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/me/recentItems".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
def change_password(self, **kwargs):
"""
Changes the current user's password and optionally logs out all other sessions
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, me.*, or me.changePassword.
Parameters:
* {hash} data - Object containing the password change info (https://api.losant.com/#/definitions/changePassword)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - A new, valid, auth token (potentially all previous tokens are now invalid) (https://api.losant.com/#/definitions/authedUser)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "data" in kwargs:
body = kwargs["data"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/me/changePassword".format(**path_params)
return self.client.request("PATCH", path, params=query_params, headers=headers, body=body)
def delete(self, **kwargs):
"""
Deletes the current user
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, me.*, or me.delete.
Parameters:
* {hash} credentials - User authentication credentials (https://api.losant.com/#/definitions/userCredentials)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If the user was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "credentials" in kwargs:
body = kwargs["credentials"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/me/delete".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
def device_counts(self, **kwargs):
"""
Returns device counts by day for the time range specified for all applications the current user owns
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, all.User.read, me.*, or me.deviceCounts.
Parameters:
* {string} start - Start of range for device count query (ms since epoch)
* {string} end - End of range for device count query (ms since epoch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Device counts by day (https://api.losant.com/#/definitions/deviceCounts)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "start" in kwargs:
query_params["start"] = kwargs["start"]
if "end" in kwargs:
query_params["end"] = kwargs["end"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/me/deviceCounts".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def disable_two_factor_auth(self, **kwargs):
"""
Disables multi-factor authentication for the current user
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, me.*, or me.disableTwoFactorAuth.
Parameters:
* {hash} data - Object containing multi-factor authentication properties (https://api.losant.com/#/definitions/multiFactorAuthDisable)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated user information (https://api.losant.com/#/definitions/me)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "data" in kwargs:
body = kwargs["data"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/me/disableTwoFactorAuth".format(**path_params)
return self.client.request("PATCH", path, params=query_params, headers=headers, body=body)
def disconnect_github(self, **kwargs):
"""
Disconnects the user from Github
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, me.*, or me.disconnectGithub.
Parameters:
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated user information (https://api.losant.com/#/definitions/me)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/me/disconnectGithub".format(**path_params)
return self.client.request("PATCH", path, params=query_params, headers=headers, body=body)
def enable_two_factor_auth(self, **kwargs):
"""
Enables multi-factor authentication for the current user
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, me.*, or me.enableTwoFactorAuth.
Parameters:
* {hash} data - Object containing multi-factor authentication properties (https://api.losant.com/#/definitions/multiFactorAuthEnable)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated user information (https://api.losant.com/#/definitions/me)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "data" in kwargs:
body = kwargs["data"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/me/enableTwoFactorAuth".format(**path_params)
return self.client.request("PATCH", path, params=query_params, headers=headers, body=body)
def fetch_recent_items(self, **kwargs):
"""
Gets a recent item list
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, all.User.read, me.*, or me.fetchRecentItems.
Parameters:
* {string} parentId - Parent id of the recent list
* {undefined} itemType - Item type to get the recent list of. Accepted values are: application, device, flow, dashboard, organization
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Recent item list (https://api.losant.com/#/definitions/recentItemList)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "parentId" in kwargs:
query_params["parentId"] = kwargs["parentId"]
if "itemType" in kwargs:
query_params["itemType"] = kwargs["itemType"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/me/recentItems".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def generate_two_factor_auth(self, **kwargs):
"""
Returns the multi-factor authentication key for the current user
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, me.*, or me.generateTwoFactorAuth.
Parameters:
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Multi-factor authentication info (https://api.losant.com/#/definitions/multiFactorAuthInfo)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/me/generateTwoFactorAuth".format(**path_params)
return self.client.request("PATCH", path, params=query_params, headers=headers, body=body)
def get(self, **kwargs):
"""
Retrieves information on the current user
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, all.User.read, me.*, or me.get.
Parameters:
* {undefined} includeRecent - Should the user include recent app/dashboard info
* {string} summaryExclude - Comma-separated list of summary fields to exclude from user summary
* {string} summaryInclude - Comma-separated list of summary fields to include in user summary
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Current user information (https://api.losant.com/#/definitions/me)
Errors:
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "includeRecent" in kwargs:
query_params["includeRecent"] = kwargs["includeRecent"]
if "summaryExclude" in kwargs:
query_params["summaryExclude"] = kwargs["summaryExclude"]
if "summaryInclude" in kwargs:
query_params["summaryInclude"] = kwargs["summaryInclude"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/me".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def invite(self, **kwargs):
"""
Retrieves information for an invitation to an organization
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, all.User.read, me.*, or me.invite.
Parameters:
* {string} inviteId - ID associated with the invitation
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Information about invitation (https://api.losant.com/#/definitions/orgInviteUser)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if invite not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "inviteId" in kwargs:
path_params["inviteId"] = kwargs["inviteId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/me/invites/{inviteId}".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def invites(self, **kwargs):
"""
Retrieves pending organization invitations for a user
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, all.User.read, me.*, or me.invites.
Parameters:
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Information about invitations (https://api.losant.com/#/definitions/orgInvitesUser)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/me/invites".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def notebook_minute_counts(self, **kwargs):
"""
Returns notebook execution usage by day for the time range specified for all applications the current user owns
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, all.User.read, me.*, or me.notebookMinuteCounts.
Parameters:
* {string} start - Start of range for notebook execution query (ms since epoch)
* {string} end - End of range for notebook execution query (ms since epoch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Notebook usage information (https://api.losant.com/#/definitions/notebookMinuteCounts)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "start" in kwargs:
query_params["start"] = kwargs["start"]
if "end" in kwargs:
query_params["end"] = kwargs["end"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/me/notebookMinuteCounts".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def patch(self, **kwargs):
"""
Updates information about the current user
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, me.*, or me.patch.
Parameters:
* {hash} user - Object containing new user properties (https://api.losant.com/#/definitions/mePatch)
* {string} summaryExclude - Comma-separated list of summary fields to exclude from user summary
* {string} summaryInclude - Comma-separated list of summary fields to include in user summary
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated user information (https://api.losant.com/#/definitions/me)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "user" in kwargs:
body = kwargs["user"]
if "summaryExclude" in kwargs:
query_params["summaryExclude"] = kwargs["summaryExclude"]
if "summaryInclude" in kwargs:
query_params["summaryInclude"] = kwargs["summaryInclude"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/me".format(**path_params)
return self.client.request("PATCH", path, params=query_params, headers=headers, body=body)
def payload_counts(self, **kwargs):
"""
Returns payload counts for the time range specified for all applications the current user owns
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, all.User.read, me.*, or me.payloadCounts.
Parameters:
* {string} start - Start of range for payload count query (ms since epoch)
* {string} end - End of range for payload count query (ms since epoch)
* {string} asBytes - If the resulting stats should be returned as bytes
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Payload counts, by type and source (https://api.losant.com/#/definitions/payloadStats)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "start" in kwargs:
query_params["start"] = kwargs["start"]
if "end" in kwargs:
query_params["end"] = kwargs["end"]
if "asBytes" in kwargs:
query_params["asBytes"] = kwargs["asBytes"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/me/payloadCounts".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def payload_counts_breakdown(self, **kwargs):
"""
Returns payload counts per resolution in the time range specified for all applications the current user owns
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, all.User.read, me.*, or me.payloadCountsBreakdown.
Parameters:
* {string} start - Start of range for payload count query (ms since epoch)
* {string} end - End of range for payload count query (ms since epoch)
* {string} resolution - Resolution in milliseconds. Accepted values are: 86400000, 3600000
* {string} asBytes - If the resulting stats should be returned as bytes
* {string} includeNonBillable - If non-billable payloads should be included in the result
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Sum of payload counts by date (https://api.losant.com/#/definitions/payloadCountsBreakdown)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "start" in kwargs:
query_params["start"] = kwargs["start"]
if "end" in kwargs:
query_params["end"] = kwargs["end"]
if "resolution" in kwargs:
query_params["resolution"] = kwargs["resolution"]
if "asBytes" in kwargs:
query_params["asBytes"] = kwargs["asBytes"]
if "includeNonBillable" in kwargs:
query_params["includeNonBillable"] = kwargs["includeNonBillable"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/me/payloadCountsBreakdown".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def refresh_token(self, **kwargs):
"""
Returns a new auth token based on the current auth token
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, or me.*.
Parameters:
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Successful token regeneration (https://api.losant.com/#/definitions/authedUser)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 401 - Unauthorized error if authentication fails (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/me/refreshToken".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def respond_to_invite(self, **kwargs):
"""
Accepts or rejects an invitation to an organization
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, me.*, or me.respondToInvite.
Parameters:
* {string} inviteId - ID associated with the invitation
* {hash} response - Response to invitation (https://api.losant.com/#/definitions/orgInviteActionUser)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Acceptance or rejection of invitation (https://api.losant.com/#/definitions/orgInviteResultUser)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if invitation not found (https://api.losant.com/#/definitions/error)
* 410 - Error if invitation has expired (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "inviteId" in kwargs:
path_params["inviteId"] = kwargs["inviteId"]
if "response" in kwargs:
body = kwargs["response"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/me/invites/{inviteId}".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
def transfer_resources(self, **kwargs):
"""
Moves resources to a new owner
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, me.*, or me.transferResources.
Parameters:
* {hash} transfer - Object containing properties of the transfer (https://api.losant.com/#/definitions/resourceTransfer)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If resource transfer was successful (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "transfer" in kwargs:
body = kwargs["transfer"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/me/transferResources".format(**path_params)
return self.client.request("PATCH", path, params=query_params, headers=headers, body=body)
def verify_email(self, **kwargs):
"""
Sends an email verification to the user
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, me.*, or me.verifyEmail.
Parameters:
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If email verification was successfully sent (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/me/verify-email".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
|
class Me(object):
''' Class containing all the actions for the Me Resource '''
def __init__(self, client):
pass
def add_recent_item(self, **kwargs):
'''
Adds an item to a recent item list
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, me.*, or me.addRecentItem.
Parameters:
* {hash} data - Object containing recent item info (https://api.losant.com/#/definitions/recentItem)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated recent item list (https://api.losant.com/#/definitions/recentItemList)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
'''
pass
def change_password(self, **kwargs):
'''
Changes the current user's password and optionally logs out all other sessions
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, me.*, or me.changePassword.
Parameters:
* {hash} data - Object containing the password change info (https://api.losant.com/#/definitions/changePassword)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - A new, valid, auth token (potentially all previous tokens are now invalid) (https://api.losant.com/#/definitions/authedUser)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
'''
pass
def delete(self, **kwargs):
'''
Deletes the current user
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, me.*, or me.delete.
Parameters:
* {hash} credentials - User authentication credentials (https://api.losant.com/#/definitions/userCredentials)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If the user was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
'''
pass
def device_counts(self, **kwargs):
'''
Returns device counts by day for the time range specified for all applications the current user owns
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, all.User.read, me.*, or me.deviceCounts.
Parameters:
* {string} start - Start of range for device count query (ms since epoch)
* {string} end - End of range for device count query (ms since epoch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Device counts by day (https://api.losant.com/#/definitions/deviceCounts)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
'''
pass
def disable_two_factor_auth(self, **kwargs):
'''
Disables multi-factor authentication for the current user
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, me.*, or me.disableTwoFactorAuth.
Parameters:
* {hash} data - Object containing multi-factor authentication properties (https://api.losant.com/#/definitions/multiFactorAuthDisable)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated user information (https://api.losant.com/#/definitions/me)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
'''
pass
def disconnect_github(self, **kwargs):
'''
Disconnects the user from Github
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, me.*, or me.disconnectGithub.
Parameters:
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated user information (https://api.losant.com/#/definitions/me)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
'''
pass
def enable_two_factor_auth(self, **kwargs):
'''
Enables multi-factor authentication for the current user
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, me.*, or me.enableTwoFactorAuth.
Parameters:
* {hash} data - Object containing multi-factor authentication properties (https://api.losant.com/#/definitions/multiFactorAuthEnable)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated user information (https://api.losant.com/#/definitions/me)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
'''
pass
def fetch_recent_items(self, **kwargs):
'''
Gets a recent item list
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, all.User.read, me.*, or me.fetchRecentItems.
Parameters:
* {string} parentId - Parent id of the recent list
* {undefined} itemType - Item type to get the recent list of. Accepted values are: application, device, flow, dashboard, organization
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Recent item list (https://api.losant.com/#/definitions/recentItemList)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
'''
pass
def generate_two_factor_auth(self, **kwargs):
'''
Returns the multi-factor authentication key for the current user
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, me.*, or me.generateTwoFactorAuth.
Parameters:
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Multi-factor authentication info (https://api.losant.com/#/definitions/multiFactorAuthInfo)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
'''
pass
def get(self, **kwargs):
'''
Retrieves information on the current user
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, all.User.read, me.*, or me.get.
Parameters:
* {undefined} includeRecent - Should the user include recent app/dashboard info
* {string} summaryExclude - Comma-separated list of summary fields to exclude from user summary
* {string} summaryInclude - Comma-separated list of summary fields to include in user summary
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Current user information (https://api.losant.com/#/definitions/me)
Errors:
'''
pass
def invite(self, **kwargs):
'''
Retrieves information for an invitation to an organization
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, all.User.read, me.*, or me.invite.
Parameters:
* {string} inviteId - ID associated with the invitation
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Information about invitation (https://api.losant.com/#/definitions/orgInviteUser)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if invite not found (https://api.losant.com/#/definitions/error)
'''
pass
def invites(self, **kwargs):
'''
Retrieves pending organization invitations for a user
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, all.User.read, me.*, or me.invites.
Parameters:
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Information about invitations (https://api.losant.com/#/definitions/orgInvitesUser)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
'''
pass
def notebook_minute_counts(self, **kwargs):
'''
Returns notebook execution usage by day for the time range specified for all applications the current user owns
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, all.User.read, me.*, or me.notebookMinuteCounts.
Parameters:
* {string} start - Start of range for notebook execution query (ms since epoch)
* {string} end - End of range for notebook execution query (ms since epoch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Notebook usage information (https://api.losant.com/#/definitions/notebookMinuteCounts)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
'''
pass
def patch(self, **kwargs):
'''
Updates information about the current user
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, me.*, or me.patch.
Parameters:
* {hash} user - Object containing new user properties (https://api.losant.com/#/definitions/mePatch)
* {string} summaryExclude - Comma-separated list of summary fields to exclude from user summary
* {string} summaryInclude - Comma-separated list of summary fields to include in user summary
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated user information (https://api.losant.com/#/definitions/me)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
'''
pass
def payload_counts(self, **kwargs):
'''
Returns payload counts for the time range specified for all applications the current user owns
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, all.User.read, me.*, or me.payloadCounts.
Parameters:
* {string} start - Start of range for payload count query (ms since epoch)
* {string} end - End of range for payload count query (ms since epoch)
* {string} asBytes - If the resulting stats should be returned as bytes
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Payload counts, by type and source (https://api.losant.com/#/definitions/payloadStats)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
'''
pass
def payload_counts_breakdown(self, **kwargs):
'''
Returns payload counts per resolution in the time range specified for all applications the current user owns
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, all.User.read, me.*, or me.payloadCountsBreakdown.
Parameters:
* {string} start - Start of range for payload count query (ms since epoch)
* {string} end - End of range for payload count query (ms since epoch)
* {string} resolution - Resolution in milliseconds. Accepted values are: 86400000, 3600000
* {string} asBytes - If the resulting stats should be returned as bytes
* {string} includeNonBillable - If non-billable payloads should be included in the result
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Sum of payload counts by date (https://api.losant.com/#/definitions/payloadCountsBreakdown)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
'''
pass
def refresh_token(self, **kwargs):
'''
Returns a new auth token based on the current auth token
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, or me.*.
Parameters:
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Successful token regeneration (https://api.losant.com/#/definitions/authedUser)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 401 - Unauthorized error if authentication fails (https://api.losant.com/#/definitions/error)
'''
pass
def respond_to_invite(self, **kwargs):
'''
Accepts or rejects an invitation to an organization
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, me.*, or me.respondToInvite.
Parameters:
* {string} inviteId - ID associated with the invitation
* {hash} response - Response to invitation (https://api.losant.com/#/definitions/orgInviteActionUser)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Acceptance or rejection of invitation (https://api.losant.com/#/definitions/orgInviteResultUser)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if invitation not found (https://api.losant.com/#/definitions/error)
* 410 - Error if invitation has expired (https://api.losant.com/#/definitions/error)
'''
pass
def transfer_resources(self, **kwargs):
'''
Moves resources to a new owner
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, me.*, or me.transferResources.
Parameters:
* {hash} transfer - Object containing properties of the transfer (https://api.losant.com/#/definitions/resourceTransfer)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If resource transfer was successful (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
'''
pass
def verify_email(self, **kwargs):
'''
Sends an email verification to the user
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, me.*, or me.verifyEmail.
Parameters:
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If email verification was successfully sent (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
'''
pass
| 22 | 21 | 42 | 8 | 17 | 18 | 6 | 1.03 | 1 | 0 | 0 | 0 | 21 | 1 | 21 | 21 | 915 | 181 | 361 | 123 | 339 | 373 | 361 | 123 | 339 | 10 | 1 | 1 | 130 |
147,213 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/integration.py
|
platformrest.integration.Integration
|
class Integration(object):
""" Class containing all the actions for the Integration Resource """
def __init__(self, client):
self.client = client
def delete(self, **kwargs):
"""
Deletes an integration
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, integration.*, or integration.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} integrationId - ID associated with the integration
* {string} includeWorkflows - If the workflows that utilize this integration should also be deleted.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If integration was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if integration was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "integrationId" in kwargs:
path_params["integrationId"] = kwargs["integrationId"]
if "includeWorkflows" in kwargs:
query_params["includeWorkflows"] = kwargs["includeWorkflows"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/integrations/{integrationId}".format(**path_params)
return self.client.request("DELETE", path, params=query_params, headers=headers, body=body)
def get(self, **kwargs):
"""
Retrieves information on an integration
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, integration.*, or integration.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} integrationId - ID associated with the integration
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - integration information (https://api.losant.com/#/definitions/integration)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if integration was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "integrationId" in kwargs:
path_params["integrationId"] = kwargs["integrationId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/integrations/{integrationId}".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def patch(self, **kwargs):
"""
Updates information about an integration
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, integration.*, or integration.patch.
Parameters:
* {string} applicationId - ID associated with the application
* {string} integrationId - ID associated with the integration
* {hash} integration - Object containing new properties of the integration (https://api.losant.com/#/definitions/integrationPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated integration information (https://api.losant.com/#/definitions/integration)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if integration was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "integrationId" in kwargs:
path_params["integrationId"] = kwargs["integrationId"]
if "integration" in kwargs:
body = kwargs["integration"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/integrations/{integrationId}".format(**path_params)
return self.client.request("PATCH", path, params=query_params, headers=headers, body=body)
|
class Integration(object):
''' Class containing all the actions for the Integration Resource '''
def __init__(self, client):
pass
def delete(self, **kwargs):
'''
Deletes an integration
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, integration.*, or integration.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} integrationId - ID associated with the integration
* {string} includeWorkflows - If the workflows that utilize this integration should also be deleted.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If integration was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if integration was not found (https://api.losant.com/#/definitions/error)
'''
pass
def get(self, **kwargs):
'''
Retrieves information on an integration
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, integration.*, or integration.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} integrationId - ID associated with the integration
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - integration information (https://api.losant.com/#/definitions/integration)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if integration was not found (https://api.losant.com/#/definitions/error)
'''
pass
def patch(self, **kwargs):
'''
Updates information about an integration
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, integration.*, or integration.patch.
Parameters:
* {string} applicationId - ID associated with the application
* {string} integrationId - ID associated with the integration
* {hash} integration - Object containing new properties of the integration (https://api.losant.com/#/definitions/integrationPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated integration information (https://api.losant.com/#/definitions/integration)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if integration was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 5 | 4 | 37 | 6 | 16 | 16 | 6 | 0.98 | 1 | 0 | 0 | 0 | 4 | 1 | 4 | 4 | 155 | 28 | 64 | 21 | 59 | 63 | 64 | 21 | 59 | 8 | 1 | 1 | 24 |
147,214 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/instance_api_tokens.py
|
platformrest.instance_api_tokens.InstanceApiTokens
|
class InstanceApiTokens(object):
""" Class containing all the actions for the Instance Api Tokens Resource """
def __init__(self, client):
self.client = client
def get(self, **kwargs):
"""
Returns the API tokens for an instance
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.Instance.read, all.User, all.User.read, instanceApiTokens.*, or instanceApiTokens.get.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} sortField - Field to sort the results by. Accepted values are: name, status, id, creationDate, lastUpdated, expirationDate
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name, status
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of API tokens (https://api.losant.com/#/definitions/apiToken)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "instanceId" in kwargs:
path_params["instanceId"] = kwargs["instanceId"]
if "sortField" in kwargs:
query_params["sortField"] = kwargs["sortField"]
if "sortDirection" in kwargs:
query_params["sortDirection"] = kwargs["sortDirection"]
if "page" in kwargs:
query_params["page"] = kwargs["page"]
if "perPage" in kwargs:
query_params["perPage"] = kwargs["perPage"]
if "filterField" in kwargs:
query_params["filterField"] = kwargs["filterField"]
if "filter" in kwargs:
query_params["filter"] = kwargs["filter"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/instances/{instanceId}/tokens".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def post(self, **kwargs):
"""
Create a new API token for an instance
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.User, instanceApiTokens.*, or instanceApiTokens.post.
Parameters:
* {string} instanceId - ID associated with the instance
* {hash} apiToken - API token information (https://api.losant.com/#/definitions/apiTokenPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - The successfully created API token (https://api.losant.com/#/definitions/apiToken)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "instanceId" in kwargs:
path_params["instanceId"] = kwargs["instanceId"]
if "apiToken" in kwargs:
body = kwargs["apiToken"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/instances/{instanceId}/tokens".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
|
class InstanceApiTokens(object):
''' Class containing all the actions for the Instance Api Tokens Resource '''
def __init__(self, client):
pass
def get(self, **kwargs):
'''
Returns the API tokens for an instance
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.Instance.read, all.User, all.User.read, instanceApiTokens.*, or instanceApiTokens.get.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} sortField - Field to sort the results by. Accepted values are: name, status, id, creationDate, lastUpdated, expirationDate
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name, status
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of API tokens (https://api.losant.com/#/definitions/apiToken)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
'''
pass
def post(self, **kwargs):
'''
Create a new API token for an instance
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.User, instanceApiTokens.*, or instanceApiTokens.post.
Parameters:
* {string} instanceId - ID associated with the instance
* {hash} apiToken - API token information (https://api.losant.com/#/definitions/apiTokenPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - The successfully created API token (https://api.losant.com/#/definitions/apiToken)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
'''
pass
| 4 | 3 | 36 | 5 | 17 | 14 | 7 | 0.86 | 1 | 0 | 0 | 0 | 3 | 1 | 3 | 3 | 114 | 19 | 51 | 15 | 47 | 44 | 51 | 15 | 47 | 12 | 1 | 1 | 20 |
147,215 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/user_api_token.py
|
platformrest.user_api_token.UserApiToken
|
class UserApiToken(object):
""" Class containing all the actions for the User Api Token Resource """
def __init__(self, client):
self.client = client
def delete(self, **kwargs):
"""
Deletes an API Token
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, userApiToken.*, or userApiToken.delete.
Parameters:
* {string} apiTokenId - ID associated with the API token
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If API token was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if API token was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "apiTokenId" in kwargs:
path_params["apiTokenId"] = kwargs["apiTokenId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/me/tokens/{apiTokenId}".format(**path_params)
return self.client.request("DELETE", path, params=query_params, headers=headers, body=body)
def get(self, **kwargs):
"""
Retrieves information on an API token
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, all.User.read, userApiToken.*, or userApiToken.get.
Parameters:
* {string} apiTokenId - ID associated with the API token
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - API token information (https://api.losant.com/#/definitions/apiToken)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if API token was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "apiTokenId" in kwargs:
path_params["apiTokenId"] = kwargs["apiTokenId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/me/tokens/{apiTokenId}".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def patch(self, **kwargs):
"""
Updates information about an API token
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, userApiToken.*, or userApiToken.patch.
Parameters:
* {string} apiTokenId - ID associated with the API token
* {hash} apiToken - Object containing new properties of the API token (https://api.losant.com/#/definitions/apiTokenPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated API token information (https://api.losant.com/#/definitions/apiToken)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if API token was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "apiTokenId" in kwargs:
path_params["apiTokenId"] = kwargs["apiTokenId"]
if "apiToken" in kwargs:
body = kwargs["apiToken"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/me/tokens/{apiTokenId}".format(**path_params)
return self.client.request("PATCH", path, params=query_params, headers=headers, body=body)
|
class UserApiToken(object):
''' Class containing all the actions for the User Api Token Resource '''
def __init__(self, client):
pass
def delete(self, **kwargs):
'''
Deletes an API Token
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, userApiToken.*, or userApiToken.delete.
Parameters:
* {string} apiTokenId - ID associated with the API token
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If API token was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if API token was not found (https://api.losant.com/#/definitions/error)
'''
pass
def get(self, **kwargs):
'''
Retrieves information on an API token
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, all.User.read, userApiToken.*, or userApiToken.get.
Parameters:
* {string} apiTokenId - ID associated with the API token
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - API token information (https://api.losant.com/#/definitions/apiToken)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if API token was not found (https://api.losant.com/#/definitions/error)
'''
pass
def patch(self, **kwargs):
'''
Updates information about an API token
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, userApiToken.*, or userApiToken.patch.
Parameters:
* {string} apiTokenId - ID associated with the API token
* {hash} apiToken - Object containing new properties of the API token (https://api.losant.com/#/definitions/apiTokenPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated API token information (https://api.losant.com/#/definitions/apiToken)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if API token was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 5 | 4 | 34 | 6 | 14 | 15 | 5 | 1.05 | 1 | 0 | 0 | 0 | 4 | 1 | 4 | 4 | 143 | 28 | 56 | 21 | 51 | 59 | 56 | 21 | 51 | 7 | 1 | 1 | 20 |
147,216 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/user_api_tokens.py
|
platformrest.user_api_tokens.UserApiTokens
|
class UserApiTokens(object):
""" Class containing all the actions for the User Api Tokens Resource """
def __init__(self, client):
self.client = client
def get(self, **kwargs):
"""
Returns the API tokens for a user
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, all.User.read, userApiTokens.*, or userApiTokens.get.
Parameters:
* {string} sortField - Field to sort the results by. Accepted values are: name, status, id, creationDate, lastUpdated, expirationDate
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name, status
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of API tokens (https://api.losant.com/#/definitions/apiToken)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "sortField" in kwargs:
query_params["sortField"] = kwargs["sortField"]
if "sortDirection" in kwargs:
query_params["sortDirection"] = kwargs["sortDirection"]
if "page" in kwargs:
query_params["page"] = kwargs["page"]
if "perPage" in kwargs:
query_params["perPage"] = kwargs["perPage"]
if "filterField" in kwargs:
query_params["filterField"] = kwargs["filterField"]
if "filter" in kwargs:
query_params["filter"] = kwargs["filter"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/me/tokens".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def post(self, **kwargs):
"""
Create a new API token for an user
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, userApiTokens.*, or userApiTokens.post.
Parameters:
* {hash} apiToken - API token information (https://api.losant.com/#/definitions/apiTokenPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - The successfully created API token (https://api.losant.com/#/definitions/apiToken)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "apiToken" in kwargs:
body = kwargs["apiToken"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/me/tokens".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
|
class UserApiTokens(object):
''' Class containing all the actions for the User Api Tokens Resource '''
def __init__(self, client):
pass
def get(self, **kwargs):
'''
Returns the API tokens for a user
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, all.User.read, userApiTokens.*, or userApiTokens.get.
Parameters:
* {string} sortField - Field to sort the results by. Accepted values are: name, status, id, creationDate, lastUpdated, expirationDate
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name, status
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of API tokens (https://api.losant.com/#/definitions/apiToken)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
'''
pass
def post(self, **kwargs):
'''
Create a new API token for an user
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, userApiTokens.*, or userApiTokens.post.
Parameters:
* {hash} apiToken - API token information (https://api.losant.com/#/definitions/apiTokenPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - The successfully created API token (https://api.losant.com/#/definitions/apiToken)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
'''
pass
| 4 | 3 | 34 | 5 | 15 | 14 | 6 | 0.89 | 1 | 0 | 0 | 0 | 3 | 1 | 3 | 3 | 108 | 19 | 47 | 15 | 43 | 42 | 47 | 15 | 43 | 11 | 1 | 1 | 18 |
147,217 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/webhook.py
|
platformrest.webhook.Webhook
|
class Webhook(object):
""" Class containing all the actions for the Webhook Resource """
def __init__(self, client):
self.client = client
def delete(self, **kwargs):
"""
Deletes a webhook
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, webhook.*, or webhook.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} webhookId - ID associated with the webhook
* {string} includeWorkflows - If the workflows that utilize this webhook should also be deleted.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If webhook was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if webhook was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "webhookId" in kwargs:
path_params["webhookId"] = kwargs["webhookId"]
if "includeWorkflows" in kwargs:
query_params["includeWorkflows"] = kwargs["includeWorkflows"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/webhooks/{webhookId}".format(**path_params)
return self.client.request("DELETE", path, params=query_params, headers=headers, body=body)
def get(self, **kwargs):
"""
Retrieves information on a webhook
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, webhook.*, or webhook.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} webhookId - ID associated with the webhook
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Webhook information (https://api.losant.com/#/definitions/webhook)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if webhook was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "webhookId" in kwargs:
path_params["webhookId"] = kwargs["webhookId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/webhooks/{webhookId}".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def patch(self, **kwargs):
"""
Updates information about a webhook
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, webhook.*, or webhook.patch.
Parameters:
* {string} applicationId - ID associated with the application
* {string} webhookId - ID associated with the webhook
* {hash} webhook - Object containing new properties of the webhook (https://api.losant.com/#/definitions/webhookPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated webhook information (https://api.losant.com/#/definitions/webhook)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if webhook was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "webhookId" in kwargs:
path_params["webhookId"] = kwargs["webhookId"]
if "webhook" in kwargs:
body = kwargs["webhook"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/webhooks/{webhookId}".format(**path_params)
return self.client.request("PATCH", path, params=query_params, headers=headers, body=body)
|
class Webhook(object):
''' Class containing all the actions for the Webhook Resource '''
def __init__(self, client):
pass
def delete(self, **kwargs):
'''
Deletes a webhook
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, webhook.*, or webhook.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} webhookId - ID associated with the webhook
* {string} includeWorkflows - If the workflows that utilize this webhook should also be deleted.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If webhook was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if webhook was not found (https://api.losant.com/#/definitions/error)
'''
pass
def get(self, **kwargs):
'''
Retrieves information on a webhook
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, webhook.*, or webhook.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} webhookId - ID associated with the webhook
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Webhook information (https://api.losant.com/#/definitions/webhook)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if webhook was not found (https://api.losant.com/#/definitions/error)
'''
pass
def patch(self, **kwargs):
'''
Updates information about a webhook
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, webhook.*, or webhook.patch.
Parameters:
* {string} applicationId - ID associated with the application
* {string} webhookId - ID associated with the webhook
* {hash} webhook - Object containing new properties of the webhook (https://api.losant.com/#/definitions/webhookPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated webhook information (https://api.losant.com/#/definitions/webhook)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if webhook was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 5 | 4 | 37 | 6 | 16 | 16 | 6 | 0.98 | 1 | 0 | 0 | 0 | 4 | 1 | 4 | 4 | 155 | 28 | 64 | 21 | 59 | 63 | 64 | 21 | 59 | 8 | 1 | 1 | 24 |
147,218 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/webhooks.py
|
platformrest.webhooks.Webhooks
|
class Webhooks(object):
""" Class containing all the actions for the Webhooks Resource """
def __init__(self, client):
self.client = client
def get(self, **kwargs):
"""
Returns the webhooks for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, webhooks.*, or webhooks.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of webhooks (https://api.losant.com/#/definitions/webhooks)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "sortField" in kwargs:
query_params["sortField"] = kwargs["sortField"]
if "sortDirection" in kwargs:
query_params["sortDirection"] = kwargs["sortDirection"]
if "page" in kwargs:
query_params["page"] = kwargs["page"]
if "perPage" in kwargs:
query_params["perPage"] = kwargs["perPage"]
if "filterField" in kwargs:
query_params["filterField"] = kwargs["filterField"]
if "filter" in kwargs:
query_params["filter"] = kwargs["filter"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/webhooks".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def post(self, **kwargs):
"""
Create a new webhook for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, webhooks.*, or webhooks.post.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} webhook - New webhook information (https://api.losant.com/#/definitions/webhookPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created webhook (https://api.losant.com/#/definitions/webhook)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "webhook" in kwargs:
body = kwargs["webhook"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/webhooks".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
|
class Webhooks(object):
''' Class containing all the actions for the Webhooks Resource '''
def __init__(self, client):
pass
def get(self, **kwargs):
'''
Returns the webhooks for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, webhooks.*, or webhooks.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of webhooks (https://api.losant.com/#/definitions/webhooks)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
def post(self, **kwargs):
'''
Create a new webhook for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, webhooks.*, or webhooks.post.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} webhook - New webhook information (https://api.losant.com/#/definitions/webhookPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created webhook (https://api.losant.com/#/definitions/webhook)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 4 | 3 | 37 | 5 | 17 | 15 | 7 | 0.9 | 1 | 0 | 0 | 0 | 3 | 1 | 3 | 3 | 116 | 19 | 51 | 15 | 47 | 46 | 51 | 15 | 47 | 12 | 1 | 1 | 20 |
147,219 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/instance_members.py
|
platformrest.instance_members.InstanceMembers
|
class InstanceMembers(object):
""" Class containing all the actions for the Instance Members Resource """
def __init__(self, client):
self.client = client
def get(self, **kwargs):
"""
Returns a collection of instance members
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.Instance.read, all.User, all.User.read, instanceMembers.*, or instanceMembers.get.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} sortField - Field to sort the results by. Accepted values are: email, role
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: email, role
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - A collection of instance members (https://api.losant.com/#/definitions/instanceMembers)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if instance was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "instanceId" in kwargs:
path_params["instanceId"] = kwargs["instanceId"]
if "sortField" in kwargs:
query_params["sortField"] = kwargs["sortField"]
if "sortDirection" in kwargs:
query_params["sortDirection"] = kwargs["sortDirection"]
if "filterField" in kwargs:
query_params["filterField"] = kwargs["filterField"]
if "filter" in kwargs:
query_params["filter"] = kwargs["filter"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/instances/{instanceId}/members".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def post(self, **kwargs):
"""
Creates a new instance member
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.User, instanceMembers.*, or instanceMembers.post.
Parameters:
* {string} instanceId - ID associated with the instance
* {hash} member - Object containing new member info (https://api.losant.com/#/definitions/instanceMemberPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - The newly created instance member (https://api.losant.com/#/definitions/instanceMember)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if instance was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "instanceId" in kwargs:
path_params["instanceId"] = kwargs["instanceId"]
if "member" in kwargs:
body = kwargs["member"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/instances/{instanceId}/members".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
|
class InstanceMembers(object):
''' Class containing all the actions for the Instance Members Resource '''
def __init__(self, client):
pass
def get(self, **kwargs):
'''
Returns a collection of instance members
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.Instance.read, all.User, all.User.read, instanceMembers.*, or instanceMembers.get.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} sortField - Field to sort the results by. Accepted values are: email, role
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: email, role
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - A collection of instance members (https://api.losant.com/#/definitions/instanceMembers)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if instance was not found (https://api.losant.com/#/definitions/error)
'''
pass
def post(self, **kwargs):
'''
Creates a new instance member
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.User, instanceMembers.*, or instanceMembers.post.
Parameters:
* {string} instanceId - ID associated with the instance
* {hash} member - Object containing new member info (https://api.losant.com/#/definitions/instanceMemberPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - The newly created instance member (https://api.losant.com/#/definitions/instanceMember)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if instance was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 4 | 3 | 35 | 5 | 15 | 14 | 6 | 0.94 | 1 | 0 | 0 | 0 | 3 | 1 | 3 | 3 | 110 | 19 | 47 | 15 | 43 | 44 | 47 | 15 | 43 | 10 | 1 | 1 | 18 |
147,220 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/instance_member.py
|
platformrest.instance_member.InstanceMember
|
class InstanceMember(object):
""" Class containing all the actions for the Instance Member Resource """
def __init__(self, client):
self.client = client
def delete(self, **kwargs):
"""
Deletes an instance member
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.User, instanceMember.*, or instanceMember.delete.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} userId - ID associated with the instance member
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If member was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if instance or member was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "instanceId" in kwargs:
path_params["instanceId"] = kwargs["instanceId"]
if "userId" in kwargs:
path_params["userId"] = kwargs["userId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/instances/{instanceId}/members/{userId}".format(**path_params)
return self.client.request("DELETE", path, params=query_params, headers=headers, body=body)
def get(self, **kwargs):
"""
Returns an instance member
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.Instance.read, all.User, all.User.read, instanceMember.*, or instanceMember.get.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} userId - ID associated with the instance member
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - A single instance member (https://api.losant.com/#/definitions/instanceMember)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if instance or member was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "instanceId" in kwargs:
path_params["instanceId"] = kwargs["instanceId"]
if "userId" in kwargs:
path_params["userId"] = kwargs["userId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/instances/{instanceId}/members/{userId}".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def patch(self, **kwargs):
"""
Modifies the role of an instance member
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.User, instanceMember.*, or instanceMember.patch.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} userId - ID associated with the instance member
* {hash} member - Object containing new member info (https://api.losant.com/#/definitions/instanceMemberPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - The modified instance member (https://api.losant.com/#/definitions/instanceMemberPatch)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if instance or member was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "instanceId" in kwargs:
path_params["instanceId"] = kwargs["instanceId"]
if "userId" in kwargs:
path_params["userId"] = kwargs["userId"]
if "member" in kwargs:
body = kwargs["member"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/instances/{instanceId}/members/{userId}".format(**path_params)
return self.client.request("PATCH", path, params=query_params, headers=headers, body=body)
|
class InstanceMember(object):
''' Class containing all the actions for the Instance Member Resource '''
def __init__(self, client):
pass
def delete(self, **kwargs):
'''
Deletes an instance member
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.User, instanceMember.*, or instanceMember.delete.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} userId - ID associated with the instance member
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If member was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if instance or member was not found (https://api.losant.com/#/definitions/error)
'''
pass
def get(self, **kwargs):
'''
Returns an instance member
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.Instance.read, all.User, all.User.read, instanceMember.*, or instanceMember.get.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} userId - ID associated with the instance member
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - A single instance member (https://api.losant.com/#/definitions/instanceMember)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if instance or member was not found (https://api.losant.com/#/definitions/error)
'''
pass
def patch(self, **kwargs):
'''
Modifies the role of an instance member
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.User, instanceMember.*, or instanceMember.patch.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} userId - ID associated with the instance member
* {hash} member - Object containing new member info (https://api.losant.com/#/definitions/instanceMemberPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - The modified instance member (https://api.losant.com/#/definitions/instanceMemberPatch)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if instance or member was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 5 | 4 | 37 | 6 | 15 | 15 | 6 | 1 | 1 | 0 | 0 | 0 | 4 | 1 | 4 | 4 | 152 | 28 | 62 | 21 | 57 | 62 | 62 | 21 | 57 | 8 | 1 | 1 | 23 |
147,221 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/instance_api_token.py
|
platformrest.instance_api_token.InstanceApiToken
|
class InstanceApiToken(object):
""" Class containing all the actions for the Instance Api Token Resource """
def __init__(self, client):
self.client = client
def delete(self, **kwargs):
"""
Deletes an API Token
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.User, instanceApiToken.*, or instanceApiToken.delete.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} apiTokenId - ID associated with the API token
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If API token was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if API token was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "instanceId" in kwargs:
path_params["instanceId"] = kwargs["instanceId"]
if "apiTokenId" in kwargs:
path_params["apiTokenId"] = kwargs["apiTokenId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/instances/{instanceId}/tokens/{apiTokenId}".format(**path_params)
return self.client.request("DELETE", path, params=query_params, headers=headers, body=body)
def get(self, **kwargs):
"""
Retrieves information on an API token
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.Instance.read, all.User, all.User.read, instanceApiToken.*, or instanceApiToken.get.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} apiTokenId - ID associated with the API token
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - API token information (https://api.losant.com/#/definitions/apiToken)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if API token was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "instanceId" in kwargs:
path_params["instanceId"] = kwargs["instanceId"]
if "apiTokenId" in kwargs:
path_params["apiTokenId"] = kwargs["apiTokenId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/instances/{instanceId}/tokens/{apiTokenId}".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def patch(self, **kwargs):
"""
Updates information about an API token
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.User, instanceApiToken.*, or instanceApiToken.patch.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} apiTokenId - ID associated with the API token
* {hash} apiToken - Object containing new properties of the API token (https://api.losant.com/#/definitions/apiTokenPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated API token information (https://api.losant.com/#/definitions/apiToken)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if API token was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "instanceId" in kwargs:
path_params["instanceId"] = kwargs["instanceId"]
if "apiTokenId" in kwargs:
path_params["apiTokenId"] = kwargs["apiTokenId"]
if "apiToken" in kwargs:
body = kwargs["apiToken"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/instances/{instanceId}/tokens/{apiTokenId}".format(**path_params)
return self.client.request("PATCH", path, params=query_params, headers=headers, body=body)
|
class InstanceApiToken(object):
''' Class containing all the actions for the Instance Api Token Resource '''
def __init__(self, client):
pass
def delete(self, **kwargs):
'''
Deletes an API Token
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.User, instanceApiToken.*, or instanceApiToken.delete.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} apiTokenId - ID associated with the API token
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If API token was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if API token was not found (https://api.losant.com/#/definitions/error)
'''
pass
def get(self, **kwargs):
'''
Retrieves information on an API token
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.Instance.read, all.User, all.User.read, instanceApiToken.*, or instanceApiToken.get.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} apiTokenId - ID associated with the API token
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - API token information (https://api.losant.com/#/definitions/apiToken)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if API token was not found (https://api.losant.com/#/definitions/error)
'''
pass
def patch(self, **kwargs):
'''
Updates information about an API token
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.User, instanceApiToken.*, or instanceApiToken.patch.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} apiTokenId - ID associated with the API token
* {hash} apiToken - Object containing new properties of the API token (https://api.losant.com/#/definitions/apiTokenPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated API token information (https://api.losant.com/#/definitions/apiToken)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if API token was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 5 | 4 | 37 | 6 | 15 | 15 | 6 | 1 | 1 | 0 | 0 | 0 | 4 | 1 | 4 | 4 | 152 | 28 | 62 | 21 | 57 | 62 | 62 | 21 | 57 | 8 | 1 | 1 | 23 |
147,222 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/flows.py
|
platformrest.flows.Flows
|
class Flows(object):
""" Class containing all the actions for the Flows Resource """
def __init__(self, client):
self.client = client
def get(self, **kwargs):
"""
Returns the flows for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flows.*, or flows.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} flowClass - Filter the workflows by the given flow class. Accepted values are: edge, embedded, cloud, customNode, experience
* {hash} triggerFilter - Array of triggers to filter by - always filters against default flow version. (https://api.losant.com/#/definitions/flowTriggerFilter)
* {string} includeCustomNodes - If the result of the request should also include the details of any custom nodes referenced by the returned workflows
* {hash} query - Workflow filter JSON object which overrides the filterField, filter, triggerFilter, and flowClass parameters. (https://api.losant.com/#/definitions/advancedFlowQuery)
* {string} allVersions - If the request should also return flows with matching versions. Only applicable for requests with an advanced query.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of flows (https://api.losant.com/#/definitions/flows)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "sortField" in kwargs:
query_params["sortField"] = kwargs["sortField"]
if "sortDirection" in kwargs:
query_params["sortDirection"] = kwargs["sortDirection"]
if "page" in kwargs:
query_params["page"] = kwargs["page"]
if "perPage" in kwargs:
query_params["perPage"] = kwargs["perPage"]
if "filterField" in kwargs:
query_params["filterField"] = kwargs["filterField"]
if "filter" in kwargs:
query_params["filter"] = kwargs["filter"]
if "flowClass" in kwargs:
query_params["flowClass"] = kwargs["flowClass"]
if "triggerFilter" in kwargs:
query_params["triggerFilter"] = kwargs["triggerFilter"]
if "includeCustomNodes" in kwargs:
query_params["includeCustomNodes"] = kwargs["includeCustomNodes"]
if "query" in kwargs:
query_params["query"] = json.dumps(kwargs["query"])
if "allVersions" in kwargs:
query_params["allVersions"] = kwargs["allVersions"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/flows".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def get_by_version(self, **kwargs):
"""
Returns the flows by version for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flows.*, or flows.getByVersion.
Parameters:
* {string} applicationId - ID associated with the application
* {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} flowClass - Filter the workflows by the given flow class. Accepted values are: edge, embedded, cloud, customNode, experience
* {string} version - Return the workflow versions for the given version.
* {hash} triggerFilter - Array of triggers to filter by - always filters against default flow version. (https://api.losant.com/#/definitions/flowTriggerFilter)
* {string} includeCustomNodes - If the result of the request should also include the details of any custom nodes referenced by the returned workflows
* {hash} query - Workflow filter JSON object which overrides the filterField, filter, triggerFilter, and flowClass parameters. (https://api.losant.com/#/definitions/advancedFlowByVersionQuery)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of flow versions (https://api.losant.com/#/definitions/flowVersions)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "sortField" in kwargs:
query_params["sortField"] = kwargs["sortField"]
if "sortDirection" in kwargs:
query_params["sortDirection"] = kwargs["sortDirection"]
if "page" in kwargs:
query_params["page"] = kwargs["page"]
if "perPage" in kwargs:
query_params["perPage"] = kwargs["perPage"]
if "filterField" in kwargs:
query_params["filterField"] = kwargs["filterField"]
if "filter" in kwargs:
query_params["filter"] = kwargs["filter"]
if "flowClass" in kwargs:
query_params["flowClass"] = kwargs["flowClass"]
if "version" in kwargs:
query_params["version"] = kwargs["version"]
if "triggerFilter" in kwargs:
query_params["triggerFilter"] = kwargs["triggerFilter"]
if "includeCustomNodes" in kwargs:
query_params["includeCustomNodes"] = kwargs["includeCustomNodes"]
if "query" in kwargs:
query_params["query"] = json.dumps(kwargs["query"])
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/flows/version".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def api_import(self, **kwargs):
"""
Import a set of flows and flow versions
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, flows.*, or flows.import.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} importData - New flow and flow version information (https://api.losant.com/#/definitions/flowsImportPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully imported workflows (https://api.losant.com/#/definitions/flowsImportResult)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "importData" in kwargs:
body = kwargs["importData"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/flows/import".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
def palette(self, **kwargs):
"""
Gets additional nodes that should be available in the palette
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flows.*, or flows.palette.
Parameters:
* {string} applicationId - ID associated with the application
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - The additional nodes available in the palette (https://api.losant.com/#/definitions/paletteResponse)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/flows/palette".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def post(self, **kwargs):
"""
Create a new flow for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, flows.*, or flows.post.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} flow - New flow information (https://api.losant.com/#/definitions/flowPost)
* {string} includeCustomNodes - If the result of the request should also include the details of any custom nodes referenced by the returned workflows
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created flow (https://api.losant.com/#/definitions/flow)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "flow" in kwargs:
body = kwargs["flow"]
if "includeCustomNodes" in kwargs:
query_params["includeCustomNodes"] = kwargs["includeCustomNodes"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/flows".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
|
class Flows(object):
''' Class containing all the actions for the Flows Resource '''
def __init__(self, client):
pass
def get(self, **kwargs):
'''
Returns the flows for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flows.*, or flows.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} flowClass - Filter the workflows by the given flow class. Accepted values are: edge, embedded, cloud, customNode, experience
* {hash} triggerFilter - Array of triggers to filter by - always filters against default flow version. (https://api.losant.com/#/definitions/flowTriggerFilter)
* {string} includeCustomNodes - If the result of the request should also include the details of any custom nodes referenced by the returned workflows
* {hash} query - Workflow filter JSON object which overrides the filterField, filter, triggerFilter, and flowClass parameters. (https://api.losant.com/#/definitions/advancedFlowQuery)
* {string} allVersions - If the request should also return flows with matching versions. Only applicable for requests with an advanced query.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of flows (https://api.losant.com/#/definitions/flows)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
def get_by_version(self, **kwargs):
'''
Returns the flows by version for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flows.*, or flows.getByVersion.
Parameters:
* {string} applicationId - ID associated with the application
* {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} flowClass - Filter the workflows by the given flow class. Accepted values are: edge, embedded, cloud, customNode, experience
* {string} version - Return the workflow versions for the given version.
* {hash} triggerFilter - Array of triggers to filter by - always filters against default flow version. (https://api.losant.com/#/definitions/flowTriggerFilter)
* {string} includeCustomNodes - If the result of the request should also include the details of any custom nodes referenced by the returned workflows
* {hash} query - Workflow filter JSON object which overrides the filterField, filter, triggerFilter, and flowClass parameters. (https://api.losant.com/#/definitions/advancedFlowByVersionQuery)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of flow versions (https://api.losant.com/#/definitions/flowVersions)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
def api_import(self, **kwargs):
'''
Import a set of flows and flow versions
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, flows.*, or flows.import.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} importData - New flow and flow version information (https://api.losant.com/#/definitions/flowsImportPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully imported workflows (https://api.losant.com/#/definitions/flowsImportResult)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
def palette(self, **kwargs):
'''
Gets additional nodes that should be available in the palette
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flows.*, or flows.palette.
Parameters:
* {string} applicationId - ID associated with the application
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - The additional nodes available in the palette (https://api.losant.com/#/definitions/paletteResponse)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
def post(self, **kwargs):
'''
Create a new flow for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, flows.*, or flows.post.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} flow - New flow information (https://api.losant.com/#/definitions/flowPost)
* {string} includeCustomNodes - If the result of the request should also include the details of any custom nodes referenced by the returned workflows
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created flow (https://api.losant.com/#/definitions/flow)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 7 | 6 | 50 | 7 | 23 | 20 | 9 | 0.88 | 1 | 0 | 0 | 0 | 6 | 1 | 6 | 6 | 305 | 46 | 138 | 33 | 131 | 121 | 138 | 33 | 131 | 17 | 1 | 1 | 56 |
147,223 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/embedded_deployments.py
|
platformrest.embedded_deployments.EmbeddedDeployments
|
class EmbeddedDeployments(object):
""" Class containing all the actions for the Embedded Deployments Resource """
def __init__(self, client):
self.client = client
def export(self, **kwargs):
"""
Request an export of the compiled WASM files for a current deployment
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, embeddedDeployments.*, or embeddedDeployments.export.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} options - Export options for embedded deployment (https://api.losant.com/#/definitions/embeddedDeploymentExport)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 202 - If generation of export was successfully started (https://api.losant.com/#/definitions/jobEnqueuedResult)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if deployment was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "options" in kwargs:
body = kwargs["options"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/embedded/deployments/export".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
def get(self, **kwargs):
"""
Returns the embedded deployments for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, embeddedDeployments.*, or embeddedDeployments.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} sortField - Field to sort the results by. Accepted values are: id, creationDate, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} deviceId - Filter deployments to the given Device ID
* {string} version - Filter deployments to the given Workflow Version (matches against both current and desired)
* {string} flowId - Filter deployments to the given Workflow ID
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of embedded deployments (https://api.losant.com/#/definitions/embeddedDeployments)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application or device was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "sortField" in kwargs:
query_params["sortField"] = kwargs["sortField"]
if "sortDirection" in kwargs:
query_params["sortDirection"] = kwargs["sortDirection"]
if "page" in kwargs:
query_params["page"] = kwargs["page"]
if "perPage" in kwargs:
query_params["perPage"] = kwargs["perPage"]
if "deviceId" in kwargs:
query_params["deviceId"] = kwargs["deviceId"]
if "version" in kwargs:
query_params["version"] = kwargs["version"]
if "flowId" in kwargs:
query_params["flowId"] = kwargs["flowId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/embedded/deployments".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def release(self, **kwargs):
"""
Deploy an embedded workflow version to one or more embedded devices. Version can be blank, if removal is desired.
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, embeddedDeployments.*, or embeddedDeployments.release.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} deployment - Deployment release information (https://api.losant.com/#/definitions/embeddedDeploymentRelease)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - If deployment release has been initiated successfully (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "deployment" in kwargs:
body = kwargs["deployment"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/embedded/deployments/release".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
def remove(self, **kwargs):
"""
Remove all embedded deployments from a device, remove all embedded deployments of a workflow, or remove a specific workflow from a specific device
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, embeddedDeployments.*, or embeddedDeployments.remove.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} deployment - Deployment removal information (https://api.losant.com/#/definitions/embeddedDeploymentRemove)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - If deployment removal has been initiated successfully (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "deployment" in kwargs:
body = kwargs["deployment"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/embedded/deployments/remove".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
def replace(self, **kwargs):
"""
Replace deployments of an embedded workflow version with a new version. New version can be blank, if removal is desired.
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, embeddedDeployments.*, or embeddedDeployments.replace.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} deployment - Deployment replacement information (https://api.losant.com/#/definitions/embeddedDeploymentReplace)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - If deployment replacement has been initiated successfully (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "deployment" in kwargs:
body = kwargs["deployment"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/embedded/deployments/replace".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
|
class EmbeddedDeployments(object):
''' Class containing all the actions for the Embedded Deployments Resource '''
def __init__(self, client):
pass
def export(self, **kwargs):
'''
Request an export of the compiled WASM files for a current deployment
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, embeddedDeployments.*, or embeddedDeployments.export.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} options - Export options for embedded deployment (https://api.losant.com/#/definitions/embeddedDeploymentExport)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 202 - If generation of export was successfully started (https://api.losant.com/#/definitions/jobEnqueuedResult)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if deployment was not found (https://api.losant.com/#/definitions/error)
'''
pass
def get(self, **kwargs):
'''
Returns the embedded deployments for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, embeddedDeployments.*, or embeddedDeployments.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} sortField - Field to sort the results by. Accepted values are: id, creationDate, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} deviceId - Filter deployments to the given Device ID
* {string} version - Filter deployments to the given Workflow Version (matches against both current and desired)
* {string} flowId - Filter deployments to the given Workflow ID
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of embedded deployments (https://api.losant.com/#/definitions/embeddedDeployments)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application or device was not found (https://api.losant.com/#/definitions/error)
'''
pass
def release(self, **kwargs):
'''
Deploy an embedded workflow version to one or more embedded devices. Version can be blank, if removal is desired.
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, embeddedDeployments.*, or embeddedDeployments.release.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} deployment - Deployment release information (https://api.losant.com/#/definitions/embeddedDeploymentRelease)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - If deployment release has been initiated successfully (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
def remove(self, **kwargs):
'''
Remove all embedded deployments from a device, remove all embedded deployments of a workflow, or remove a specific workflow from a specific device
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, embeddedDeployments.*, or embeddedDeployments.remove.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} deployment - Deployment removal information (https://api.losant.com/#/definitions/embeddedDeploymentRemove)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - If deployment removal has been initiated successfully (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
def replace(self, **kwargs):
'''
Replace deployments of an embedded workflow version with a new version. New version can be blank, if removal is desired.
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, embeddedDeployments.*, or embeddedDeployments.replace.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} deployment - Deployment replacement information (https://api.losant.com/#/definitions/embeddedDeploymentReplace)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - If deployment replacement has been initiated successfully (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 7 | 6 | 43 | 7 | 18 | 18 | 7 | 0.97 | 1 | 0 | 0 | 0 | 6 | 1 | 6 | 6 | 263 | 46 | 110 | 33 | 103 | 107 | 110 | 33 | 103 | 13 | 1 | 1 | 42 |
147,224 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/embedded_deployment.py
|
platformrest.embedded_deployment.EmbeddedDeployment
|
class EmbeddedDeployment(object):
""" Class containing all the actions for the Embedded Deployment Resource """
def __init__(self, client):
self.client = client
def get(self, **kwargs):
"""
Retrieves information on an embedded deployment
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, embeddedDeployment.*, or embeddedDeployment.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} embeddedDeploymentId - ID associated with the embedded deployment
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Embedded deployment information (https://api.losant.com/#/definitions/embeddedDeployment)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if embedded deployment was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "embeddedDeploymentId" in kwargs:
path_params["embeddedDeploymentId"] = kwargs["embeddedDeploymentId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/embedded/deployments/{embeddedDeploymentId}".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
|
class EmbeddedDeployment(object):
''' Class containing all the actions for the Embedded Deployment Resource '''
def __init__(self, client):
pass
def get(self, **kwargs):
'''
Retrieves information on an embedded deployment
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, embeddedDeployment.*, or embeddedDeployment.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} embeddedDeploymentId - ID associated with the embedded deployment
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Embedded deployment information (https://api.losant.com/#/definitions/embeddedDeployment)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if embedded deployment was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 3 | 2 | 25 | 4 | 11 | 10 | 4 | 0.95 | 1 | 0 | 0 | 0 | 2 | 1 | 2 | 2 | 53 | 10 | 22 | 9 | 19 | 21 | 22 | 9 | 19 | 7 | 1 | 1 | 8 |
147,225 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/application_dashboard.py
|
platformrest.application_dashboard.ApplicationDashboard
|
class ApplicationDashboard(object):
""" Class containing all the actions for the Application Dashboard Resource """
def __init__(self, client):
self.client = client
def delete(self, **kwargs):
"""
Deletes a dashboard
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, applicationDashboard.*, or applicationDashboard.delete.
Parameters:
* {string} dashboardId - ID of the associated dashboard
* {string} applicationId - ID of the associated application
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If dashboard was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if dashboard was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "dashboardId" in kwargs:
path_params["dashboardId"] = kwargs["dashboardId"]
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/dashboards/{dashboardId}".format(**path_params)
return self.client.request("DELETE", path, params=query_params, headers=headers, body=body)
def get(self, **kwargs):
"""
Retrieves information on a dashboard
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, applicationDashboard.*, or applicationDashboard.get.
Parameters:
* {string} dashboardId - ID of the associated dashboard
* {string} applicationId - ID of the associated application
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Dashboard information (https://api.losant.com/#/definitions/dashboard)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if dashboard was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "dashboardId" in kwargs:
path_params["dashboardId"] = kwargs["dashboardId"]
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/dashboards/{dashboardId}".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def patch(self, **kwargs):
"""
Updates information about a dashboard
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, applicationDashboard.*, or applicationDashboard.patch.
Parameters:
* {string} dashboardId - ID of the associated dashboard
* {string} applicationId - ID of the associated application
* {hash} dashboard - Object containing new dashboard properties (https://api.losant.com/#/definitions/dashboardPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Update dashboard information (https://api.losant.com/#/definitions/dashboard)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if dashboard was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "dashboardId" in kwargs:
path_params["dashboardId"] = kwargs["dashboardId"]
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "dashboard" in kwargs:
body = kwargs["dashboard"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/dashboards/{dashboardId}".format(**path_params)
return self.client.request("PATCH", path, params=query_params, headers=headers, body=body)
def send_report(self, **kwargs):
"""
Sends a snapshot of a dashboard
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, applicationDashboard.*, or applicationDashboard.sendReport.
Parameters:
* {string} dashboardId - ID of the associated dashboard
* {string} applicationId - ID of the associated application
* {hash} reportConfig - Object containing report options (https://api.losant.com/#/definitions/dashboardSendReport)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 202 - If dashboard report was enqueued to be sent (https://api.losant.com/#/definitions/jobEnqueuedResult)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if dashboard was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "dashboardId" in kwargs:
path_params["dashboardId"] = kwargs["dashboardId"]
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "reportConfig" in kwargs:
body = kwargs["reportConfig"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/dashboards/{dashboardId}".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
|
class ApplicationDashboard(object):
''' Class containing all the actions for the Application Dashboard Resource '''
def __init__(self, client):
pass
def delete(self, **kwargs):
'''
Deletes a dashboard
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, applicationDashboard.*, or applicationDashboard.delete.
Parameters:
* {string} dashboardId - ID of the associated dashboard
* {string} applicationId - ID of the associated application
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If dashboard was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if dashboard was not found (https://api.losant.com/#/definitions/error)
'''
pass
def get(self, **kwargs):
'''
Retrieves information on a dashboard
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, applicationDashboard.*, or applicationDashboard.get.
Parameters:
* {string} dashboardId - ID of the associated dashboard
* {string} applicationId - ID of the associated application
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Dashboard information (https://api.losant.com/#/definitions/dashboard)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if dashboard was not found (https://api.losant.com/#/definitions/error)
'''
pass
def patch(self, **kwargs):
'''
Updates information about a dashboard
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, applicationDashboard.*, or applicationDashboard.patch.
Parameters:
* {string} dashboardId - ID of the associated dashboard
* {string} applicationId - ID of the associated application
* {hash} dashboard - Object containing new dashboard properties (https://api.losant.com/#/definitions/dashboardPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Update dashboard information (https://api.losant.com/#/definitions/dashboard)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if dashboard was not found (https://api.losant.com/#/definitions/error)
'''
pass
def send_report(self, **kwargs):
'''
Sends a snapshot of a dashboard
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, applicationDashboard.*, or applicationDashboard.sendReport.
Parameters:
* {string} dashboardId - ID of the associated dashboard
* {string} applicationId - ID of the associated application
* {hash} reportConfig - Object containing report options (https://api.losant.com/#/definitions/dashboardSendReport)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 202 - If dashboard report was enqueued to be sent (https://api.losant.com/#/definitions/jobEnqueuedResult)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if dashboard was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 6 | 5 | 39 | 6 | 16 | 16 | 6 | 1 | 1 | 0 | 0 | 0 | 5 | 1 | 5 | 5 | 203 | 37 | 83 | 27 | 77 | 83 | 83 | 27 | 77 | 8 | 1 | 1 | 31 |
147,226 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/application_dashboards.py
|
platformrest.application_dashboards.ApplicationDashboards
|
class ApplicationDashboards(object):
""" Class containing all the actions for the Application Dashboards Resource """
def __init__(self, client):
self.client = client
def get(self, **kwargs):
"""
Returns all dashboards scoped to the given application.
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, applicationDashboards.*, or applicationDashboards.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of dashboards (https://api.losant.com/#/definitions/dashboards)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "sortField" in kwargs:
query_params["sortField"] = kwargs["sortField"]
if "sortDirection" in kwargs:
query_params["sortDirection"] = kwargs["sortDirection"]
if "page" in kwargs:
query_params["page"] = kwargs["page"]
if "perPage" in kwargs:
query_params["perPage"] = kwargs["perPage"]
if "filterField" in kwargs:
query_params["filterField"] = kwargs["filterField"]
if "filter" in kwargs:
query_params["filter"] = kwargs["filter"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/dashboards".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def post(self, **kwargs):
"""
Create a new dashboard
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, applicationDashboards.*, or applicationDashboards.post.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} dashboard - New dashboard information (https://api.losant.com/#/definitions/applicationDashboardPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created dashboard (https://api.losant.com/#/definitions/dashboard)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "dashboard" in kwargs:
body = kwargs["dashboard"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/dashboards".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
|
class ApplicationDashboards(object):
''' Class containing all the actions for the Application Dashboards Resource '''
def __init__(self, client):
pass
def get(self, **kwargs):
'''
Returns all dashboards scoped to the given application.
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, applicationDashboards.*, or applicationDashboards.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of dashboards (https://api.losant.com/#/definitions/dashboards)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
def post(self, **kwargs):
'''
Create a new dashboard
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, applicationDashboards.*, or applicationDashboards.post.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} dashboard - New dashboard information (https://api.losant.com/#/definitions/applicationDashboardPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created dashboard (https://api.losant.com/#/definitions/dashboard)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 4 | 3 | 37 | 5 | 17 | 15 | 7 | 0.9 | 1 | 0 | 0 | 0 | 3 | 1 | 3 | 3 | 116 | 19 | 51 | 15 | 47 | 46 | 51 | 15 | 47 | 12 | 1 | 1 | 20 |
147,227 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/application_key.py
|
platformrest.application_key.ApplicationKey
|
class ApplicationKey(object):
""" Class containing all the actions for the Application Key Resource """
def __init__(self, client):
self.client = client
def delete(self, **kwargs):
"""
Deletes an applicationKey
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, applicationKey.*, or applicationKey.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} applicationKeyId - ID associated with the applicationKey
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If applicationKey was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if applicationKey was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "applicationKeyId" in kwargs:
path_params["applicationKeyId"] = kwargs["applicationKeyId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/keys/{applicationKeyId}".format(**path_params)
return self.client.request("DELETE", path, params=query_params, headers=headers, body=body)
def get(self, **kwargs):
"""
Retrieves information on an applicationKey
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, applicationKey.*, or applicationKey.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} applicationKeyId - ID associated with the applicationKey
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - applicationKey information (https://api.losant.com/#/definitions/applicationKey)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if applicationKey was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "applicationKeyId" in kwargs:
path_params["applicationKeyId"] = kwargs["applicationKeyId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/keys/{applicationKeyId}".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def patch(self, **kwargs):
"""
Updates information about an applicationKey
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, applicationKey.*, or applicationKey.patch.
Parameters:
* {string} applicationId - ID associated with the application
* {string} applicationKeyId - ID associated with the applicationKey
* {hash} applicationKey - Object containing new properties of the applicationKey (https://api.losant.com/#/definitions/applicationKeyPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated applicationKey information (https://api.losant.com/#/definitions/applicationKey)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if applicationKey was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "applicationKeyId" in kwargs:
path_params["applicationKeyId"] = kwargs["applicationKeyId"]
if "applicationKey" in kwargs:
body = kwargs["applicationKey"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/keys/{applicationKeyId}".format(**path_params)
return self.client.request("PATCH", path, params=query_params, headers=headers, body=body)
|
class ApplicationKey(object):
''' Class containing all the actions for the Application Key Resource '''
def __init__(self, client):
pass
def delete(self, **kwargs):
'''
Deletes an applicationKey
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, applicationKey.*, or applicationKey.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} applicationKeyId - ID associated with the applicationKey
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If applicationKey was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if applicationKey was not found (https://api.losant.com/#/definitions/error)
'''
pass
def get(self, **kwargs):
'''
Retrieves information on an applicationKey
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, applicationKey.*, or applicationKey.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} applicationKeyId - ID associated with the applicationKey
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - applicationKey information (https://api.losant.com/#/definitions/applicationKey)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if applicationKey was not found (https://api.losant.com/#/definitions/error)
'''
pass
def patch(self, **kwargs):
'''
Updates information about an applicationKey
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, applicationKey.*, or applicationKey.patch.
Parameters:
* {string} applicationId - ID associated with the application
* {string} applicationKeyId - ID associated with the applicationKey
* {hash} applicationKey - Object containing new properties of the applicationKey (https://api.losant.com/#/definitions/applicationKeyPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated applicationKey information (https://api.losant.com/#/definitions/applicationKey)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if applicationKey was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 5 | 4 | 37 | 6 | 15 | 15 | 6 | 1 | 1 | 0 | 0 | 0 | 4 | 1 | 4 | 4 | 152 | 28 | 62 | 21 | 57 | 62 | 62 | 21 | 57 | 8 | 1 | 1 | 23 |
147,228 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/instance.py
|
platformrest.instance.Instance
|
class Instance(object):
""" Class containing all the actions for the Instance Resource """
def __init__(self, client):
self.client = client
def device_counts(self, **kwargs):
"""
Returns device counts by day for the time range specified for this instance
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.Instance.read, all.User, all.User.read, instance.*, or instance.deviceCounts.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} start - Start of range for device count query (ms since epoch)
* {string} end - End of range for device count query (ms since epoch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Device counts by day (https://api.losant.com/#/definitions/deviceCounts)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if instance was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "instanceId" in kwargs:
path_params["instanceId"] = kwargs["instanceId"]
if "start" in kwargs:
query_params["start"] = kwargs["start"]
if "end" in kwargs:
query_params["end"] = kwargs["end"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/instances/{instanceId}/deviceCounts".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def generate_report(self, **kwargs):
"""
Generates a CSV report on instance stats
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.Instance.read, all.User, all.User.read, instance.*, or instance.generateReport.
Parameters:
* {string} instanceId - ID associated with the instance
* {hash} options - Object containing report configuration (https://api.losant.com/#/definitions/instanceReportOptionsPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 202 - If generation of report was successfully started (https://api.losant.com/#/definitions/jobEnqueuedResult)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "instanceId" in kwargs:
path_params["instanceId"] = kwargs["instanceId"]
if "options" in kwargs:
body = kwargs["options"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/instances/{instanceId}/generateReport".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
def get(self, **kwargs):
"""
Returns an instance
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.Instance.read, all.User, all.User.read, instance.*, or instance.get.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - A single instance (https://api.losant.com/#/definitions/instance)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if instance was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "instanceId" in kwargs:
path_params["instanceId"] = kwargs["instanceId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/instances/{instanceId}".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def historical_summaries(self, **kwargs):
"""
Return historical summary entries for an instance
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.Instance.read, all.User, all.User.read, instance.*, or instance.historicalSummaries.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} month - Timestamp within the month to report a summary for.
* {string} sortField - Field to sort the results by. Accepted values are: resourceId, currentPeriodStart
* {string} sortDirection - Direction to sort the results in. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: resourceType, resourceId, ownerId, ownerType
* {string} filter - Filter to apply against the filtered field. Blank or not provided means no filtering.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of historical summaries (https://api.losant.com/#/definitions/historicalSummaries)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "instanceId" in kwargs:
path_params["instanceId"] = kwargs["instanceId"]
if "month" in kwargs:
query_params["month"] = kwargs["month"]
if "sortField" in kwargs:
query_params["sortField"] = kwargs["sortField"]
if "sortDirection" in kwargs:
query_params["sortDirection"] = kwargs["sortDirection"]
if "page" in kwargs:
query_params["page"] = kwargs["page"]
if "perPage" in kwargs:
query_params["perPage"] = kwargs["perPage"]
if "filterField" in kwargs:
query_params["filterField"] = kwargs["filterField"]
if "filter" in kwargs:
query_params["filter"] = kwargs["filter"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/instances/{instanceId}/historicalSummaries".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def notebook_minute_counts(self, **kwargs):
"""
Returns notebook execution usage by day for the time range specified for this instance
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.Instance.read, all.User, all.User.read, instance.*, or instance.notebookMinuteCounts.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} start - Start of range for notebook execution query (ms since epoch)
* {string} end - End of range for notebook execution query (ms since epoch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Notebook usage information (https://api.losant.com/#/definitions/notebookMinuteCounts)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if instance was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "instanceId" in kwargs:
path_params["instanceId"] = kwargs["instanceId"]
if "start" in kwargs:
query_params["start"] = kwargs["start"]
if "end" in kwargs:
query_params["end"] = kwargs["end"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/instances/{instanceId}/notebookMinuteCounts".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def patch(self, **kwargs):
"""
Updates information about an instance
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.User, instance.*, or instance.patch.
Parameters:
* {string} instanceId - ID associated with the instance
* {hash} instance - Updated instance information (https://api.losant.com/#/definitions/instancePatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - The updated instance object (https://api.losant.com/#/definitions/instance)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "instanceId" in kwargs:
path_params["instanceId"] = kwargs["instanceId"]
if "instance" in kwargs:
body = kwargs["instance"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/instances/{instanceId}".format(**path_params)
return self.client.request("PATCH", path, params=query_params, headers=headers, body=body)
def payload_counts(self, **kwargs):
"""
Returns payload counts for the time range specified for this instance
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.Instance.read, all.User, all.User.read, instance.*, or instance.payloadCounts.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} start - Start of range for payload count query (ms since epoch)
* {string} end - End of range for payload count query (ms since epoch)
* {string} asBytes - If the resulting stats should be returned as bytes
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Payload counts, by type and source (https://api.losant.com/#/definitions/payloadStats)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if instance was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "instanceId" in kwargs:
path_params["instanceId"] = kwargs["instanceId"]
if "start" in kwargs:
query_params["start"] = kwargs["start"]
if "end" in kwargs:
query_params["end"] = kwargs["end"]
if "asBytes" in kwargs:
query_params["asBytes"] = kwargs["asBytes"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/instances/{instanceId}/payloadCounts".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def payload_counts_breakdown(self, **kwargs):
"""
Returns payload counts per resolution in the time range specified for this instance
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.Instance.read, all.User, all.User.read, instance.*, or instance.payloadCountsBreakdown.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} start - Start of range for payload count query (ms since epoch)
* {string} end - End of range for payload count query (ms since epoch)
* {string} resolution - Resolution in milliseconds. Accepted values are: 86400000, 3600000
* {string} asBytes - If the resulting stats should be returned as bytes
* {string} includeNonBillable - If non-billable payloads should be included in the result
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Sum of payload counts by date (https://api.losant.com/#/definitions/payloadCountsBreakdown)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if instance was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "instanceId" in kwargs:
path_params["instanceId"] = kwargs["instanceId"]
if "start" in kwargs:
query_params["start"] = kwargs["start"]
if "end" in kwargs:
query_params["end"] = kwargs["end"]
if "resolution" in kwargs:
query_params["resolution"] = kwargs["resolution"]
if "asBytes" in kwargs:
query_params["asBytes"] = kwargs["asBytes"]
if "includeNonBillable" in kwargs:
query_params["includeNonBillable"] = kwargs["includeNonBillable"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/instances/{instanceId}/payloadCountsBreakdown".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
|
class Instance(object):
''' Class containing all the actions for the Instance Resource '''
def __init__(self, client):
pass
def device_counts(self, **kwargs):
'''
Returns device counts by day for the time range specified for this instance
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.Instance.read, all.User, all.User.read, instance.*, or instance.deviceCounts.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} start - Start of range for device count query (ms since epoch)
* {string} end - End of range for device count query (ms since epoch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Device counts by day (https://api.losant.com/#/definitions/deviceCounts)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if instance was not found (https://api.losant.com/#/definitions/error)
'''
pass
def generate_report(self, **kwargs):
'''
Generates a CSV report on instance stats
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.Instance.read, all.User, all.User.read, instance.*, or instance.generateReport.
Parameters:
* {string} instanceId - ID associated with the instance
* {hash} options - Object containing report configuration (https://api.losant.com/#/definitions/instanceReportOptionsPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 202 - If generation of report was successfully started (https://api.losant.com/#/definitions/jobEnqueuedResult)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
'''
pass
def get(self, **kwargs):
'''
Returns an instance
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.Instance.read, all.User, all.User.read, instance.*, or instance.get.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - A single instance (https://api.losant.com/#/definitions/instance)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if instance was not found (https://api.losant.com/#/definitions/error)
'''
pass
def historical_summaries(self, **kwargs):
'''
Return historical summary entries for an instance
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.Instance.read, all.User, all.User.read, instance.*, or instance.historicalSummaries.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} month - Timestamp within the month to report a summary for.
* {string} sortField - Field to sort the results by. Accepted values are: resourceId, currentPeriodStart
* {string} sortDirection - Direction to sort the results in. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: resourceType, resourceId, ownerId, ownerType
* {string} filter - Filter to apply against the filtered field. Blank or not provided means no filtering.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of historical summaries (https://api.losant.com/#/definitions/historicalSummaries)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
'''
pass
def notebook_minute_counts(self, **kwargs):
'''
Returns notebook execution usage by day for the time range specified for this instance
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.Instance.read, all.User, all.User.read, instance.*, or instance.notebookMinuteCounts.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} start - Start of range for notebook execution query (ms since epoch)
* {string} end - End of range for notebook execution query (ms since epoch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Notebook usage information (https://api.losant.com/#/definitions/notebookMinuteCounts)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if instance was not found (https://api.losant.com/#/definitions/error)
'''
pass
def patch(self, **kwargs):
'''
Updates information about an instance
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.User, instance.*, or instance.patch.
Parameters:
* {string} instanceId - ID associated with the instance
* {hash} instance - Updated instance information (https://api.losant.com/#/definitions/instancePatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - The updated instance object (https://api.losant.com/#/definitions/instance)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
'''
pass
def payload_counts(self, **kwargs):
'''
Returns payload counts for the time range specified for this instance
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.Instance.read, all.User, all.User.read, instance.*, or instance.payloadCounts.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} start - Start of range for payload count query (ms since epoch)
* {string} end - End of range for payload count query (ms since epoch)
* {string} asBytes - If the resulting stats should be returned as bytes
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Payload counts, by type and source (https://api.losant.com/#/definitions/payloadStats)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if instance was not found (https://api.losant.com/#/definitions/error)
'''
pass
def payload_counts_breakdown(self, **kwargs):
'''
Returns payload counts per resolution in the time range specified for this instance
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.Instance.read, all.User, all.User.read, instance.*, or instance.payloadCountsBreakdown.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} start - Start of range for payload count query (ms since epoch)
* {string} end - End of range for payload count query (ms since epoch)
* {string} resolution - Resolution in milliseconds. Accepted values are: 86400000, 3600000
* {string} asBytes - If the resulting stats should be returned as bytes
* {string} includeNonBillable - If non-billable payloads should be included in the result
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Sum of payload counts by date (https://api.losant.com/#/definitions/payloadCountsBreakdown)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if instance was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 10 | 9 | 46 | 7 | 20 | 19 | 8 | 0.94 | 1 | 0 | 0 | 0 | 9 | 1 | 9 | 9 | 425 | 73 | 181 | 51 | 171 | 171 | 181 | 51 | 171 | 13 | 1 | 1 | 70 |
147,229 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/audit_log.py
|
platformrest.audit_log.AuditLog
|
class AuditLog(object):
""" Class containing all the actions for the Audit Log Resource """
def __init__(self, client):
self.client = client
def get(self, **kwargs):
"""
Retrieves information on an audit log
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.Organization.read, all.User, all.User.read, auditLog.*, or auditLog.get.
Parameters:
* {string} orgId - ID associated with the organization
* {string} auditLogId - ID associated with the audit log
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Audit log information (https://api.losant.com/#/definitions/auditLog)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if audit log was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "orgId" in kwargs:
path_params["orgId"] = kwargs["orgId"]
if "auditLogId" in kwargs:
path_params["auditLogId"] = kwargs["auditLogId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/orgs/{orgId}/audit-logs/{auditLogId}".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
|
class AuditLog(object):
''' Class containing all the actions for the Audit Log Resource '''
def __init__(self, client):
pass
def get(self, **kwargs):
'''
Retrieves information on an audit log
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.Organization.read, all.User, all.User.read, auditLog.*, or auditLog.get.
Parameters:
* {string} orgId - ID associated with the organization
* {string} auditLogId - ID associated with the audit log
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Audit log information (https://api.losant.com/#/definitions/auditLog)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if audit log was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 3 | 2 | 25 | 4 | 11 | 10 | 4 | 0.95 | 1 | 0 | 0 | 0 | 2 | 1 | 2 | 2 | 53 | 10 | 22 | 9 | 19 | 21 | 22 | 9 | 19 | 7 | 1 | 1 | 8 |
147,230 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/instance_custom_nodes.py
|
platformrest.instance_custom_nodes.InstanceCustomNodes
|
class InstanceCustomNodes(object):
""" Class containing all the actions for the Instance Custom Nodes Resource """
def __init__(self, client):
self.client = client
def get(self, **kwargs):
"""
Returns the Custom Nodes for an instance
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.Instance.read, all.User, all.User.read, instanceCustomNodes.*, or instanceCustomNodes.get.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of Custom Nodes (https://api.losant.com/#/definitions/instanceCustomNodes)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "instanceId" in kwargs:
path_params["instanceId"] = kwargs["instanceId"]
if "sortField" in kwargs:
query_params["sortField"] = kwargs["sortField"]
if "sortDirection" in kwargs:
query_params["sortDirection"] = kwargs["sortDirection"]
if "page" in kwargs:
query_params["page"] = kwargs["page"]
if "perPage" in kwargs:
query_params["perPage"] = kwargs["perPage"]
if "filterField" in kwargs:
query_params["filterField"] = kwargs["filterField"]
if "filter" in kwargs:
query_params["filter"] = kwargs["filter"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/instances/{instanceId}/nodes".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def post(self, **kwargs):
"""
Create a new Custom Node for an instance
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.User, instanceCustomNodes.*, or instanceCustomNodes.post.
Parameters:
* {string} instanceId - ID associated with the instance
* {hash} instanceCustomNode - Custom Node information (https://api.losant.com/#/definitions/instanceCustomNodePost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - The successfully created Custom Node (https://api.losant.com/#/definitions/instanceCustomNode)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "instanceId" in kwargs:
path_params["instanceId"] = kwargs["instanceId"]
if "instanceCustomNode" in kwargs:
body = kwargs["instanceCustomNode"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/instances/{instanceId}/nodes".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
|
class InstanceCustomNodes(object):
''' Class containing all the actions for the Instance Custom Nodes Resource '''
def __init__(self, client):
pass
def get(self, **kwargs):
'''
Returns the Custom Nodes for an instance
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.Instance.read, all.User, all.User.read, instanceCustomNodes.*, or instanceCustomNodes.get.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of Custom Nodes (https://api.losant.com/#/definitions/instanceCustomNodes)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
'''
pass
def post(self, **kwargs):
'''
Create a new Custom Node for an instance
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.User, instanceCustomNodes.*, or instanceCustomNodes.post.
Parameters:
* {string} instanceId - ID associated with the instance
* {hash} instanceCustomNode - Custom Node information (https://api.losant.com/#/definitions/instanceCustomNodePost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - The successfully created Custom Node (https://api.losant.com/#/definitions/instanceCustomNode)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
'''
pass
| 4 | 3 | 36 | 5 | 17 | 14 | 7 | 0.86 | 1 | 0 | 0 | 0 | 3 | 1 | 3 | 3 | 114 | 19 | 51 | 15 | 47 | 44 | 51 | 15 | 47 | 12 | 1 | 1 | 20 |
147,231 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/instance_audit_logs.py
|
platformrest.instance_audit_logs.InstanceAuditLogs
|
class InstanceAuditLogs(object):
""" Class containing all the actions for the Instance Audit Logs Resource """
def __init__(self, client):
self.client = client
def get(self, **kwargs):
"""
Returns the audit logs for the instance
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.Instance.read, all.User, all.User.read, instanceAuditLogs.*, or instanceAuditLogs.get.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} sortField - Field to sort the results by. Accepted values are: creationDate, responseStatus, actorName
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} start - Start of time range for audit log query
* {string} end - End of time range for audit log query
* {hash} auditLogFilter - Filters for the audit log query (https://api.losant.com/#/definitions/instanceAuditLogFilter)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of instance audit logs (https://api.losant.com/#/definitions/instanceAuditLogs)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if instance was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "instanceId" in kwargs:
path_params["instanceId"] = kwargs["instanceId"]
if "sortField" in kwargs:
query_params["sortField"] = kwargs["sortField"]
if "sortDirection" in kwargs:
query_params["sortDirection"] = kwargs["sortDirection"]
if "page" in kwargs:
query_params["page"] = kwargs["page"]
if "perPage" in kwargs:
query_params["perPage"] = kwargs["perPage"]
if "start" in kwargs:
query_params["start"] = kwargs["start"]
if "end" in kwargs:
query_params["end"] = kwargs["end"]
if "auditLogFilter" in kwargs:
query_params["auditLogFilter"] = kwargs["auditLogFilter"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/instance/{instanceId}/audit-logs".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
|
class InstanceAuditLogs(object):
''' Class containing all the actions for the Instance Audit Logs Resource '''
def __init__(self, client):
pass
def get(self, **kwargs):
'''
Returns the audit logs for the instance
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.Instance.read, all.User, all.User.read, instanceAuditLogs.*, or instanceAuditLogs.get.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} sortField - Field to sort the results by. Accepted values are: creationDate, responseStatus, actorName
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} start - Start of time range for audit log query
* {string} end - End of time range for audit log query
* {hash} auditLogFilter - Filters for the audit log query (https://api.losant.com/#/definitions/instanceAuditLogFilter)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of instance audit logs (https://api.losant.com/#/definitions/instanceAuditLogs)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if instance was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 3 | 2 | 34 | 4 | 17 | 13 | 7 | 0.79 | 1 | 0 | 0 | 0 | 2 | 1 | 2 | 2 | 71 | 10 | 34 | 9 | 31 | 27 | 34 | 9 | 31 | 13 | 1 | 1 | 14 |
147,232 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/integrations.py
|
platformrest.integrations.Integrations
|
class Integrations(object):
""" Class containing all the actions for the Integrations Resource """
def __init__(self, client):
self.client = client
def get(self, **kwargs):
"""
Returns the integrations for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, integrations.*, or integrations.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, integrationType, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name, integrationType
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of integrations (https://api.losant.com/#/definitions/integrations)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "sortField" in kwargs:
query_params["sortField"] = kwargs["sortField"]
if "sortDirection" in kwargs:
query_params["sortDirection"] = kwargs["sortDirection"]
if "page" in kwargs:
query_params["page"] = kwargs["page"]
if "perPage" in kwargs:
query_params["perPage"] = kwargs["perPage"]
if "filterField" in kwargs:
query_params["filterField"] = kwargs["filterField"]
if "filter" in kwargs:
query_params["filter"] = kwargs["filter"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/integrations".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def post(self, **kwargs):
"""
Create a new integration for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, integrations.*, or integrations.post.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} integration - New integration information (https://api.losant.com/#/definitions/integrationPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created integration (https://api.losant.com/#/definitions/integration)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "integration" in kwargs:
body = kwargs["integration"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/integrations".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
|
class Integrations(object):
''' Class containing all the actions for the Integrations Resource '''
def __init__(self, client):
pass
def get(self, **kwargs):
'''
Returns the integrations for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, integrations.*, or integrations.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, integrationType, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name, integrationType
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of integrations (https://api.losant.com/#/definitions/integrations)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
def post(self, **kwargs):
'''
Create a new integration for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, integrations.*, or integrations.post.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} integration - New integration information (https://api.losant.com/#/definitions/integrationPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created integration (https://api.losant.com/#/definitions/integration)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 4 | 3 | 37 | 5 | 17 | 15 | 7 | 0.9 | 1 | 0 | 0 | 0 | 3 | 1 | 3 | 3 | 116 | 19 | 51 | 15 | 47 | 46 | 51 | 15 | 47 | 12 | 1 | 1 | 20 |
147,233 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/applications.py
|
platformrest.applications.Applications
|
class Applications(object):
""" Class containing all the actions for the Applications Resource """
def __init__(self, client):
self.client = client
def get(self, **kwargs):
"""
Returns the applications the current user has permission to see
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.Organization.read, all.User, all.User.cli, all.User.read, applications.*, or applications.get.
Parameters:
* {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, ownerId, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} orgId - If not provided, return all applications. If provided but blank, only return applications belonging to the current user. If provided and an id, only return applications belonging to the given organization id.
* {string} summaryExclude - Comma-separated list of summary fields to exclude from application summary
* {string} summaryInclude - Comma-separated list of summary fields to include in application summary
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of applications (https://api.losant.com/#/definitions/applications)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "sortField" in kwargs:
query_params["sortField"] = kwargs["sortField"]
if "sortDirection" in kwargs:
query_params["sortDirection"] = kwargs["sortDirection"]
if "page" in kwargs:
query_params["page"] = kwargs["page"]
if "perPage" in kwargs:
query_params["perPage"] = kwargs["perPage"]
if "filterField" in kwargs:
query_params["filterField"] = kwargs["filterField"]
if "filter" in kwargs:
query_params["filter"] = kwargs["filter"]
if "orgId" in kwargs:
query_params["orgId"] = kwargs["orgId"]
if "summaryExclude" in kwargs:
query_params["summaryExclude"] = kwargs["summaryExclude"]
if "summaryInclude" in kwargs:
query_params["summaryInclude"] = kwargs["summaryInclude"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def period_summaries(self, **kwargs):
"""
Returns application usage summaries over a selected date range
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.Organization.read, all.User, all.User.read, applications.*, or applications.periodSummaries.
Parameters:
* {string} start - Start of range for resource count queries (ms since epoch)
* {string} end - End of range for resource count queries (ms since epoch)
* {string} asBytes - If the resulting payload counts should be returned as bytes
* {string} includeNonBillable - If non-billable payloads should be included in the result
* {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, ownerId, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} orgId - If not provided, return all applications. If provided but blank, only return applications belonging to the current user. If provided and an id, only return applications belonging to the given organization id.
* {string} exclude - Comma-separated list of resources to exclude from summary
* {string} include - Comma-separated list of summary fields to include in application summary
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of application period summaries (https://api.losant.com/#/definitions/periodSummaries)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "start" in kwargs:
query_params["start"] = kwargs["start"]
if "end" in kwargs:
query_params["end"] = kwargs["end"]
if "asBytes" in kwargs:
query_params["asBytes"] = kwargs["asBytes"]
if "includeNonBillable" in kwargs:
query_params["includeNonBillable"] = kwargs["includeNonBillable"]
if "sortField" in kwargs:
query_params["sortField"] = kwargs["sortField"]
if "sortDirection" in kwargs:
query_params["sortDirection"] = kwargs["sortDirection"]
if "page" in kwargs:
query_params["page"] = kwargs["page"]
if "perPage" in kwargs:
query_params["perPage"] = kwargs["perPage"]
if "filterField" in kwargs:
query_params["filterField"] = kwargs["filterField"]
if "filter" in kwargs:
query_params["filter"] = kwargs["filter"]
if "orgId" in kwargs:
query_params["orgId"] = kwargs["orgId"]
if "exclude" in kwargs:
query_params["exclude"] = kwargs["exclude"]
if "include" in kwargs:
query_params["include"] = kwargs["include"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/periodSummaries".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def post(self, **kwargs):
"""
Create a new application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.User, applications.*, or applications.post.
Parameters:
* {hash} application - New application information (https://api.losant.com/#/definitions/applicationPost)
* {string} summaryExclude - Comma-separated list of summary fields to exclude from application summary
* {string} summaryInclude - Comma-separated list of summary fields to include in application summary
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created application (https://api.losant.com/#/definitions/application)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "application" in kwargs:
body = kwargs["application"]
if "summaryExclude" in kwargs:
query_params["summaryExclude"] = kwargs["summaryExclude"]
if "summaryInclude" in kwargs:
query_params["summaryInclude"] = kwargs["summaryInclude"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
|
class Applications(object):
''' Class containing all the actions for the Applications Resource '''
def __init__(self, client):
pass
def get(self, **kwargs):
'''
Returns the applications the current user has permission to see
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.Organization.read, all.User, all.User.cli, all.User.read, applications.*, or applications.get.
Parameters:
* {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, ownerId, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} orgId - If not provided, return all applications. If provided but blank, only return applications belonging to the current user. If provided and an id, only return applications belonging to the given organization id.
* {string} summaryExclude - Comma-separated list of summary fields to exclude from application summary
* {string} summaryInclude - Comma-separated list of summary fields to include in application summary
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of applications (https://api.losant.com/#/definitions/applications)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
'''
pass
def period_summaries(self, **kwargs):
'''
Returns application usage summaries over a selected date range
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.Organization.read, all.User, all.User.read, applications.*, or applications.periodSummaries.
Parameters:
* {string} start - Start of range for resource count queries (ms since epoch)
* {string} end - End of range for resource count queries (ms since epoch)
* {string} asBytes - If the resulting payload counts should be returned as bytes
* {string} includeNonBillable - If non-billable payloads should be included in the result
* {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, ownerId, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} orgId - If not provided, return all applications. If provided but blank, only return applications belonging to the current user. If provided and an id, only return applications belonging to the given organization id.
* {string} exclude - Comma-separated list of resources to exclude from summary
* {string} include - Comma-separated list of summary fields to include in application summary
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of application period summaries (https://api.losant.com/#/definitions/periodSummaries)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
'''
pass
def post(self, **kwargs):
'''
Create a new application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.User, applications.*, or applications.post.
Parameters:
* {hash} application - New application information (https://api.losant.com/#/definitions/applicationPost)
* {string} summaryExclude - Comma-separated list of summary fields to exclude from application summary
* {string} summaryInclude - Comma-separated list of summary fields to include in application summary
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created application (https://api.losant.com/#/definitions/application)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
'''
pass
| 5 | 4 | 49 | 6 | 24 | 19 | 10 | 0.79 | 1 | 0 | 0 | 0 | 4 | 1 | 4 | 4 | 203 | 28 | 98 | 21 | 93 | 77 | 98 | 21 | 93 | 18 | 1 | 1 | 41 |
147,234 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/application_certificate_authority.py
|
platformrest.application_certificate_authority.ApplicationCertificateAuthority
|
class ApplicationCertificateAuthority(object):
""" Class containing all the actions for the Application Certificate Authority Resource """
def __init__(self, client):
self.client = client
def delete(self, **kwargs):
"""
Deletes an application certificate authority
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, applicationCertificateAuthority.*, or applicationCertificateAuthority.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} applicationCertificateAuthorityId - ID associated with the application certificate authority
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If application certificate authority was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application certificate authority was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "applicationCertificateAuthorityId" in kwargs:
path_params["applicationCertificateAuthorityId"] = kwargs["applicationCertificateAuthorityId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/certificate-authorities/{applicationCertificateAuthorityId}".format(**path_params)
return self.client.request("DELETE", path, params=query_params, headers=headers, body=body)
def get(self, **kwargs):
"""
Retrieves information on an application certificate authority
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, applicationCertificateAuthority.*, or applicationCertificateAuthority.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} applicationCertificateAuthorityId - ID associated with the application certificate authority
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Application certificate authority information (https://api.losant.com/#/definitions/applicationCertificateAuthority)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application certificate authority was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "applicationCertificateAuthorityId" in kwargs:
path_params["applicationCertificateAuthorityId"] = kwargs["applicationCertificateAuthorityId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/certificate-authorities/{applicationCertificateAuthorityId}".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def patch(self, **kwargs):
"""
Updates information about an application certificate authority
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, applicationCertificateAuthority.*, or applicationCertificateAuthority.patch.
Parameters:
* {string} applicationId - ID associated with the application
* {string} applicationCertificateAuthorityId - ID associated with the application certificate authority
* {hash} applicationCertificateAuthority - Object containing new properties of the application certificate authority (https://api.losant.com/#/definitions/applicationCertificateAuthorityPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated application certificate authority information (https://api.losant.com/#/definitions/applicationCertificateAuthority)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application certificate authority was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "applicationCertificateAuthorityId" in kwargs:
path_params["applicationCertificateAuthorityId"] = kwargs["applicationCertificateAuthorityId"]
if "applicationCertificateAuthority" in kwargs:
body = kwargs["applicationCertificateAuthority"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/certificate-authorities/{applicationCertificateAuthorityId}".format(**path_params)
return self.client.request("PATCH", path, params=query_params, headers=headers, body=body)
|
class ApplicationCertificateAuthority(object):
''' Class containing all the actions for the Application Certificate Authority Resource '''
def __init__(self, client):
pass
def delete(self, **kwargs):
'''
Deletes an application certificate authority
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, applicationCertificateAuthority.*, or applicationCertificateAuthority.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} applicationCertificateAuthorityId - ID associated with the application certificate authority
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If application certificate authority was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application certificate authority was not found (https://api.losant.com/#/definitions/error)
'''
pass
def get(self, **kwargs):
'''
Retrieves information on an application certificate authority
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, applicationCertificateAuthority.*, or applicationCertificateAuthority.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} applicationCertificateAuthorityId - ID associated with the application certificate authority
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Application certificate authority information (https://api.losant.com/#/definitions/applicationCertificateAuthority)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application certificate authority was not found (https://api.losant.com/#/definitions/error)
'''
pass
def patch(self, **kwargs):
'''
Updates information about an application certificate authority
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, applicationCertificateAuthority.*, or applicationCertificateAuthority.patch.
Parameters:
* {string} applicationId - ID associated with the application
* {string} applicationCertificateAuthorityId - ID associated with the application certificate authority
* {hash} applicationCertificateAuthority - Object containing new properties of the application certificate authority (https://api.losant.com/#/definitions/applicationCertificateAuthorityPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated application certificate authority information (https://api.losant.com/#/definitions/applicationCertificateAuthority)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application certificate authority was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 5 | 4 | 37 | 6 | 15 | 15 | 6 | 1 | 1 | 0 | 0 | 0 | 4 | 1 | 4 | 4 | 152 | 28 | 62 | 21 | 57 | 62 | 62 | 21 | 57 | 8 | 1 | 1 | 23 |
147,235 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/notebook.py
|
platformrest.notebook.Notebook
|
class Notebook(object):
""" Class containing all the actions for the Notebook Resource """
def __init__(self, client):
self.client = client
def cancel_execution(self, **kwargs):
"""
Marks a specific notebook execution for cancellation
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, notebook.*, or notebook.execute.
Parameters:
* {string} applicationId - ID associated with the application
* {string} notebookId - ID associated with the notebook
* {undefined} executionId - The ID of the execution to cancel
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If the execution was successfully marked for cancellation (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if execution was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "notebookId" in kwargs:
path_params["notebookId"] = kwargs["notebookId"]
if "executionId" in kwargs:
query_params["executionId"] = kwargs["executionId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/notebooks/{notebookId}/cancelExecution".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
def delete(self, **kwargs):
"""
Deletes a notebook
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, notebook.*, or notebook.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} notebookId - ID associated with the notebook
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If notebook was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if notebook was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "notebookId" in kwargs:
path_params["notebookId"] = kwargs["notebookId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/notebooks/{notebookId}".format(**path_params)
return self.client.request("DELETE", path, params=query_params, headers=headers, body=body)
def execute(self, **kwargs):
"""
Triggers the execution of a notebook
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, notebook.*, or notebook.execute.
Parameters:
* {string} applicationId - ID associated with the application
* {string} notebookId - ID associated with the notebook
* {hash} executionOptions - The options for the execution (https://api.losant.com/#/definitions/notebookExecutionOptions)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If execution request was accepted and successfully queued (https://api.losant.com/#/definitions/successWithExecutionId)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if notebook was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "notebookId" in kwargs:
path_params["notebookId"] = kwargs["notebookId"]
if "executionOptions" in kwargs:
body = kwargs["executionOptions"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/notebooks/{notebookId}/execute".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
def get(self, **kwargs):
"""
Retrieves information on a notebook
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, notebook.*, or notebook.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} notebookId - ID associated with the notebook
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - notebook information (https://api.losant.com/#/definitions/notebook)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if notebook was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "notebookId" in kwargs:
path_params["notebookId"] = kwargs["notebookId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/notebooks/{notebookId}".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def logs(self, **kwargs):
"""
Retrieves information on notebook executions
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, notebook.*, or notebook.logs.
Parameters:
* {string} applicationId - ID associated with the application
* {string} notebookId - ID associated with the notebook
* {string} limit - Max log entries to return (ordered by time descending)
* {string} since - Look for log entries since this time (ms since epoch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - notebook execution information (https://api.losant.com/#/definitions/notebookExecutionLogs)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if notebook was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "notebookId" in kwargs:
path_params["notebookId"] = kwargs["notebookId"]
if "limit" in kwargs:
query_params["limit"] = kwargs["limit"]
if "since" in kwargs:
query_params["since"] = kwargs["since"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/notebooks/{notebookId}/logs".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def notebook_minute_counts(self, **kwargs):
"""
Returns notebook execution usage by day for the time range specified for this notebook
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, notebook.*, or notebook.notebookMinuteCounts.
Parameters:
* {string} applicationId - ID associated with the application
* {string} notebookId - ID associated with the notebook
* {string} start - Start of range for notebook execution query (ms since epoch)
* {string} end - End of range for notebook execution query (ms since epoch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Notebook usage information (https://api.losant.com/#/definitions/notebookMinuteCounts)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if notebook was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "notebookId" in kwargs:
path_params["notebookId"] = kwargs["notebookId"]
if "start" in kwargs:
query_params["start"] = kwargs["start"]
if "end" in kwargs:
query_params["end"] = kwargs["end"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/notebooks/{notebookId}/notebookMinuteCounts".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def patch(self, **kwargs):
"""
Updates information about a notebook
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, notebook.*, or notebook.patch.
Parameters:
* {string} applicationId - ID associated with the application
* {string} notebookId - ID associated with the notebook
* {hash} notebook - Object containing new properties of the notebook (https://api.losant.com/#/definitions/notebookPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated notebook information (https://api.losant.com/#/definitions/notebook)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if notebook was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "notebookId" in kwargs:
path_params["notebookId"] = kwargs["notebookId"]
if "notebook" in kwargs:
body = kwargs["notebook"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/notebooks/{notebookId}".format(**path_params)
return self.client.request("PATCH", path, params=query_params, headers=headers, body=body)
def request_input_data_export(self, **kwargs):
"""
Requests a combined zip file of the potential input data for a notebook execution
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, notebook.*, or notebook.requestInputDataExport.
Parameters:
* {string} applicationId - ID associated with the application
* {string} notebookId - ID associated with the notebook
* {hash} exportOptions - The options for the export (https://api.losant.com/#/definitions/notebookDataExportOptions)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 202 - If export request was accepted and successfully queued (https://api.losant.com/#/definitions/jobEnqueuedResult)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if notebook was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "notebookId" in kwargs:
path_params["notebookId"] = kwargs["notebookId"]
if "exportOptions" in kwargs:
body = kwargs["exportOptions"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/notebooks/{notebookId}/requestInputDataExport".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
|
class Notebook(object):
''' Class containing all the actions for the Notebook Resource '''
def __init__(self, client):
pass
def cancel_execution(self, **kwargs):
'''
Marks a specific notebook execution for cancellation
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, notebook.*, or notebook.execute.
Parameters:
* {string} applicationId - ID associated with the application
* {string} notebookId - ID associated with the notebook
* {undefined} executionId - The ID of the execution to cancel
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If the execution was successfully marked for cancellation (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if execution was not found (https://api.losant.com/#/definitions/error)
'''
pass
def delete(self, **kwargs):
'''
Deletes a notebook
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, notebook.*, or notebook.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} notebookId - ID associated with the notebook
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If notebook was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if notebook was not found (https://api.losant.com/#/definitions/error)
'''
pass
def execute(self, **kwargs):
'''
Triggers the execution of a notebook
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, notebook.*, or notebook.execute.
Parameters:
* {string} applicationId - ID associated with the application
* {string} notebookId - ID associated with the notebook
* {hash} executionOptions - The options for the execution (https://api.losant.com/#/definitions/notebookExecutionOptions)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If execution request was accepted and successfully queued (https://api.losant.com/#/definitions/successWithExecutionId)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if notebook was not found (https://api.losant.com/#/definitions/error)
'''
pass
def get(self, **kwargs):
'''
Retrieves information on a notebook
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, notebook.*, or notebook.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} notebookId - ID associated with the notebook
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - notebook information (https://api.losant.com/#/definitions/notebook)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if notebook was not found (https://api.losant.com/#/definitions/error)
'''
pass
def logs(self, **kwargs):
'''
Retrieves information on notebook executions
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, notebook.*, or notebook.logs.
Parameters:
* {string} applicationId - ID associated with the application
* {string} notebookId - ID associated with the notebook
* {string} limit - Max log entries to return (ordered by time descending)
* {string} since - Look for log entries since this time (ms since epoch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - notebook execution information (https://api.losant.com/#/definitions/notebookExecutionLogs)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if notebook was not found (https://api.losant.com/#/definitions/error)
'''
pass
def notebook_minute_counts(self, **kwargs):
'''
Returns notebook execution usage by day for the time range specified for this notebook
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, notebook.*, or notebook.notebookMinuteCounts.
Parameters:
* {string} applicationId - ID associated with the application
* {string} notebookId - ID associated with the notebook
* {string} start - Start of range for notebook execution query (ms since epoch)
* {string} end - End of range for notebook execution query (ms since epoch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Notebook usage information (https://api.losant.com/#/definitions/notebookMinuteCounts)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if notebook was not found (https://api.losant.com/#/definitions/error)
'''
pass
def patch(self, **kwargs):
'''
Updates information about a notebook
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, notebook.*, or notebook.patch.
Parameters:
* {string} applicationId - ID associated with the application
* {string} notebookId - ID associated with the notebook
* {hash} notebook - Object containing new properties of the notebook (https://api.losant.com/#/definitions/notebookPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated notebook information (https://api.losant.com/#/definitions/notebook)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if notebook was not found (https://api.losant.com/#/definitions/error)
'''
pass
def request_input_data_export(self, **kwargs):
'''
Requests a combined zip file of the potential input data for a notebook execution
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, notebook.*, or notebook.requestInputDataExport.
Parameters:
* {string} applicationId - ID associated with the application
* {string} notebookId - ID associated with the notebook
* {hash} exportOptions - The options for the export (https://api.losant.com/#/definitions/notebookDataExportOptions)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 202 - If export request was accepted and successfully queued (https://api.losant.com/#/definitions/jobEnqueuedResult)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if notebook was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 10 | 9 | 45 | 7 | 19 | 19 | 7 | 0.99 | 1 | 0 | 0 | 0 | 9 | 1 | 9 | 9 | 413 | 73 | 171 | 51 | 161 | 169 | 171 | 51 | 161 | 9 | 1 | 1 | 65 |
147,236 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/notebooks.py
|
platformrest.notebooks.Notebooks
|
class Notebooks(object):
""" Class containing all the actions for the Notebooks Resource """
def __init__(self, client):
self.client = client
def get(self, **kwargs):
"""
Returns the notebooks for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, notebooks.*, or notebooks.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, lastUpdated, lastExecutionRequested
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of notebooks (https://api.losant.com/#/definitions/notebooks)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "sortField" in kwargs:
query_params["sortField"] = kwargs["sortField"]
if "sortDirection" in kwargs:
query_params["sortDirection"] = kwargs["sortDirection"]
if "page" in kwargs:
query_params["page"] = kwargs["page"]
if "perPage" in kwargs:
query_params["perPage"] = kwargs["perPage"]
if "filterField" in kwargs:
query_params["filterField"] = kwargs["filterField"]
if "filter" in kwargs:
query_params["filter"] = kwargs["filter"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/notebooks".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def post(self, **kwargs):
"""
Create a new notebook for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, notebooks.*, or notebooks.post.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} notebook - New notebook information (https://api.losant.com/#/definitions/notebookPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created notebook (https://api.losant.com/#/definitions/notebook)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "notebook" in kwargs:
body = kwargs["notebook"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/notebooks".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
|
class Notebooks(object):
''' Class containing all the actions for the Notebooks Resource '''
def __init__(self, client):
pass
def get(self, **kwargs):
'''
Returns the notebooks for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, notebooks.*, or notebooks.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, lastUpdated, lastExecutionRequested
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of notebooks (https://api.losant.com/#/definitions/notebooks)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
def post(self, **kwargs):
'''
Create a new notebook for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, notebooks.*, or notebooks.post.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} notebook - New notebook information (https://api.losant.com/#/definitions/notebookPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created notebook (https://api.losant.com/#/definitions/notebook)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 4 | 3 | 37 | 5 | 17 | 15 | 7 | 0.9 | 1 | 0 | 0 | 0 | 3 | 1 | 3 | 3 | 116 | 19 | 51 | 15 | 47 | 46 | 51 | 15 | 47 | 12 | 1 | 1 | 20 |
147,237 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/org.py
|
platformrest.org.Org
|
class Org(object):
""" Class containing all the actions for the Org Resource """
def __init__(self, client):
self.client = client
def delete(self, **kwargs):
"""
Deletes an organization
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.User, org.*, or org.delete.
Parameters:
* {string} orgId - ID associated with the organization
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If organization was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if organization was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "orgId" in kwargs:
path_params["orgId"] = kwargs["orgId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/orgs/{orgId}".format(**path_params)
return self.client.request("DELETE", path, params=query_params, headers=headers, body=body)
def device_counts(self, **kwargs):
"""
Returns device counts by day for the time range specified for this organization
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.Organization.read, all.User, all.User.read, org.*, or org.deviceCounts.
Parameters:
* {string} orgId - ID associated with the organization
* {string} start - Start of range for device count query (ms since epoch)
* {string} end - End of range for device count query (ms since epoch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Device counts by day (https://api.losant.com/#/definitions/deviceCounts)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if organization was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "orgId" in kwargs:
path_params["orgId"] = kwargs["orgId"]
if "start" in kwargs:
query_params["start"] = kwargs["start"]
if "end" in kwargs:
query_params["end"] = kwargs["end"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/orgs/{orgId}/deviceCounts".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def get(self, **kwargs):
"""
Retrieves information on an organization
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.Organization.read, all.User, all.User.read, org.*, or org.get.
Parameters:
* {string} orgId - ID associated with the organization
* {string} summaryExclude - Comma-separated list of summary fields to exclude from org summary
* {string} summaryInclude - Comma-separated list of summary fields to include in org summary
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Organization information (https://api.losant.com/#/definitions/org)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if organization not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "orgId" in kwargs:
path_params["orgId"] = kwargs["orgId"]
if "summaryExclude" in kwargs:
query_params["summaryExclude"] = kwargs["summaryExclude"]
if "summaryInclude" in kwargs:
query_params["summaryInclude"] = kwargs["summaryInclude"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/orgs/{orgId}".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def invite_member(self, **kwargs):
"""
Invites a person to an organization
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.User, org.*, or org.inviteMember.
Parameters:
* {string} orgId - ID associated with the organization
* {hash} invite - Object containing new invite info (https://api.losant.com/#/definitions/orgInvitePost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Invitation information (https://api.losant.com/#/definitions/orgInvites)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if organization not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "orgId" in kwargs:
path_params["orgId"] = kwargs["orgId"]
if "invite" in kwargs:
body = kwargs["invite"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/orgs/{orgId}/invites".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
def modify_member(self, **kwargs):
"""
Modifies a current org member's role
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.User, org.*, or org.modifyMember.
Parameters:
* {string} orgId - ID associated with the organization
* {hash} member - Object containing new member pair (https://api.losant.com/#/definitions/orgMemberPatch)
* {string} summaryExclude - Comma-separated list of summary fields to exclude from org summary
* {string} summaryInclude - Comma-separated list of summary fields to include in org summary
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated organization information (https://api.losant.com/#/definitions/org)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if organization not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "orgId" in kwargs:
path_params["orgId"] = kwargs["orgId"]
if "member" in kwargs:
body = kwargs["member"]
if "summaryExclude" in kwargs:
query_params["summaryExclude"] = kwargs["summaryExclude"]
if "summaryInclude" in kwargs:
query_params["summaryInclude"] = kwargs["summaryInclude"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/orgs/{orgId}/member".format(**path_params)
return self.client.request("PATCH", path, params=query_params, headers=headers, body=body)
def notebook_minute_counts(self, **kwargs):
"""
Returns notebook execution usage by day for the time range specified for this organization
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.Organization.read, all.User, all.User.read, org.*, or org.notebookMinuteCounts.
Parameters:
* {string} orgId - ID associated with the organization
* {string} start - Start of range for notebook execution query (ms since epoch)
* {string} end - End of range for notebook execution query (ms since epoch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Notebook usage information (https://api.losant.com/#/definitions/notebookMinuteCounts)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if organization was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "orgId" in kwargs:
path_params["orgId"] = kwargs["orgId"]
if "start" in kwargs:
query_params["start"] = kwargs["start"]
if "end" in kwargs:
query_params["end"] = kwargs["end"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/orgs/{orgId}/notebookMinuteCounts".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def patch(self, **kwargs):
"""
Updates information about an organization
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.User, org.*, or org.patch.
Parameters:
* {string} orgId - ID associated with the organization
* {hash} organization - Object containing new organization properties (https://api.losant.com/#/definitions/orgPatch)
* {string} summaryExclude - Comma-separated list of summary fields to exclude from org summary
* {string} summaryInclude - Comma-separated list of summary fields to include in org summary
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated organization information (https://api.losant.com/#/definitions/org)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if organization was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "orgId" in kwargs:
path_params["orgId"] = kwargs["orgId"]
if "organization" in kwargs:
body = kwargs["organization"]
if "summaryExclude" in kwargs:
query_params["summaryExclude"] = kwargs["summaryExclude"]
if "summaryInclude" in kwargs:
query_params["summaryInclude"] = kwargs["summaryInclude"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/orgs/{orgId}".format(**path_params)
return self.client.request("PATCH", path, params=query_params, headers=headers, body=body)
def payload_counts(self, **kwargs):
"""
Returns payload counts for the time range specified for all applications this organization owns
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.Organization.read, all.User, all.User.read, org.*, or org.payloadCounts.
Parameters:
* {string} orgId - ID associated with the organization
* {string} start - Start of range for payload count query (ms since epoch)
* {string} end - End of range for payload count query (ms since epoch)
* {string} asBytes - If the resulting stats should be returned as bytes
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Payload counts, by type and source (https://api.losant.com/#/definitions/payloadStats)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if organization was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "orgId" in kwargs:
path_params["orgId"] = kwargs["orgId"]
if "start" in kwargs:
query_params["start"] = kwargs["start"]
if "end" in kwargs:
query_params["end"] = kwargs["end"]
if "asBytes" in kwargs:
query_params["asBytes"] = kwargs["asBytes"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/orgs/{orgId}/payloadCounts".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def payload_counts_breakdown(self, **kwargs):
"""
Returns payload counts per resolution in the time range specified for all application this organization owns
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.Organization.read, all.User, all.User.read, org.*, or org.payloadCountsBreakdown.
Parameters:
* {string} orgId - ID associated with the organization
* {string} start - Start of range for payload count query (ms since epoch)
* {string} end - End of range for payload count query (ms since epoch)
* {string} resolution - Resolution in milliseconds. Accepted values are: 86400000, 3600000
* {string} asBytes - If the resulting stats should be returned as bytes
* {string} includeNonBillable - If non-billable payloads should be included in the result
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Sum of payload counts by date (https://api.losant.com/#/definitions/payloadCountsBreakdown)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if organization was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "orgId" in kwargs:
path_params["orgId"] = kwargs["orgId"]
if "start" in kwargs:
query_params["start"] = kwargs["start"]
if "end" in kwargs:
query_params["end"] = kwargs["end"]
if "resolution" in kwargs:
query_params["resolution"] = kwargs["resolution"]
if "asBytes" in kwargs:
query_params["asBytes"] = kwargs["asBytes"]
if "includeNonBillable" in kwargs:
query_params["includeNonBillable"] = kwargs["includeNonBillable"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/orgs/{orgId}/payloadCountsBreakdown".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def pending_invites(self, **kwargs):
"""
Gets the current pending invites
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.Organization.read, all.User, all.User.read, org.*, or org.pendingInvites.
Parameters:
* {string} orgId - ID associated with the organization
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Invitation information (https://api.losant.com/#/definitions/orgInvites)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if organization not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "orgId" in kwargs:
path_params["orgId"] = kwargs["orgId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/orgs/{orgId}/invites".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def remove_member(self, **kwargs):
"""
Removes a member from the org
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.User, org.*, or org.removeMember.
Parameters:
* {string} orgId - ID associated with the organization
* {string} userId - Id of user to remove
* {string} summaryExclude - Comma-separated list of summary fields to exclude from org summary
* {string} summaryInclude - Comma-separated list of summary fields to include in org summary
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated organization information (https://api.losant.com/#/definitions/org)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if organization not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "orgId" in kwargs:
path_params["orgId"] = kwargs["orgId"]
if "userId" in kwargs:
query_params["userId"] = kwargs["userId"]
if "summaryExclude" in kwargs:
query_params["summaryExclude"] = kwargs["summaryExclude"]
if "summaryInclude" in kwargs:
query_params["summaryInclude"] = kwargs["summaryInclude"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/orgs/{orgId}/member".format(**path_params)
return self.client.request("DELETE", path, params=query_params, headers=headers, body=body)
def revoke_invite(self, **kwargs):
"""
Revokes an existing invite
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.User, org.*, or org.revokeInvite.
Parameters:
* {string} orgId - ID associated with the organization
* {string} inviteId - Id of invite to revoke
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Invitation information (https://api.losant.com/#/definitions/orgInvites)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if organization not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "orgId" in kwargs:
path_params["orgId"] = kwargs["orgId"]
if "inviteId" in kwargs:
query_params["inviteId"] = kwargs["inviteId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/orgs/{orgId}/invites".format(**path_params)
return self.client.request("DELETE", path, params=query_params, headers=headers, body=body)
def transfer_resources(self, **kwargs):
"""
Moves resources to a new owner
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.User, org.*, or org.transferResources.
Parameters:
* {string} orgId - ID associated with the organization
* {hash} transfer - Object containing properties of the transfer (https://api.losant.com/#/definitions/resourceTransfer)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If resource transfer was successful (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if organization was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "orgId" in kwargs:
path_params["orgId"] = kwargs["orgId"]
if "transfer" in kwargs:
body = kwargs["transfer"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/orgs/{orgId}/transferResources".format(**path_params)
return self.client.request("PATCH", path, params=query_params, headers=headers, body=body)
|
class Org(object):
''' Class containing all the actions for the Org Resource '''
def __init__(self, client):
pass
def delete(self, **kwargs):
'''
Deletes an organization
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.User, org.*, or org.delete.
Parameters:
* {string} orgId - ID associated with the organization
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If organization was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if organization was not found (https://api.losant.com/#/definitions/error)
'''
pass
def device_counts(self, **kwargs):
'''
Returns device counts by day for the time range specified for this organization
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.Organization.read, all.User, all.User.read, org.*, or org.deviceCounts.
Parameters:
* {string} orgId - ID associated with the organization
* {string} start - Start of range for device count query (ms since epoch)
* {string} end - End of range for device count query (ms since epoch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Device counts by day (https://api.losant.com/#/definitions/deviceCounts)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if organization was not found (https://api.losant.com/#/definitions/error)
'''
pass
def get(self, **kwargs):
'''
Retrieves information on an organization
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.Organization.read, all.User, all.User.read, org.*, or org.get.
Parameters:
* {string} orgId - ID associated with the organization
* {string} summaryExclude - Comma-separated list of summary fields to exclude from org summary
* {string} summaryInclude - Comma-separated list of summary fields to include in org summary
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Organization information (https://api.losant.com/#/definitions/org)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if organization not found (https://api.losant.com/#/definitions/error)
'''
pass
def invite_member(self, **kwargs):
'''
Invites a person to an organization
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.User, org.*, or org.inviteMember.
Parameters:
* {string} orgId - ID associated with the organization
* {hash} invite - Object containing new invite info (https://api.losant.com/#/definitions/orgInvitePost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Invitation information (https://api.losant.com/#/definitions/orgInvites)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if organization not found (https://api.losant.com/#/definitions/error)
'''
pass
def modify_member(self, **kwargs):
'''
Modifies a current org member's role
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.User, org.*, or org.modifyMember.
Parameters:
* {string} orgId - ID associated with the organization
* {hash} member - Object containing new member pair (https://api.losant.com/#/definitions/orgMemberPatch)
* {string} summaryExclude - Comma-separated list of summary fields to exclude from org summary
* {string} summaryInclude - Comma-separated list of summary fields to include in org summary
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated organization information (https://api.losant.com/#/definitions/org)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if organization not found (https://api.losant.com/#/definitions/error)
'''
pass
def notebook_minute_counts(self, **kwargs):
'''
Returns notebook execution usage by day for the time range specified for this organization
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.Organization.read, all.User, all.User.read, org.*, or org.notebookMinuteCounts.
Parameters:
* {string} orgId - ID associated with the organization
* {string} start - Start of range for notebook execution query (ms since epoch)
* {string} end - End of range for notebook execution query (ms since epoch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Notebook usage information (https://api.losant.com/#/definitions/notebookMinuteCounts)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if organization was not found (https://api.losant.com/#/definitions/error)
'''
pass
def patch(self, **kwargs):
'''
Updates information about an organization
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.User, org.*, or org.patch.
Parameters:
* {string} orgId - ID associated with the organization
* {hash} organization - Object containing new organization properties (https://api.losant.com/#/definitions/orgPatch)
* {string} summaryExclude - Comma-separated list of summary fields to exclude from org summary
* {string} summaryInclude - Comma-separated list of summary fields to include in org summary
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated organization information (https://api.losant.com/#/definitions/org)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if organization was not found (https://api.losant.com/#/definitions/error)
'''
pass
def payload_counts(self, **kwargs):
'''
Returns payload counts for the time range specified for all applications this organization owns
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.Organization.read, all.User, all.User.read, org.*, or org.payloadCounts.
Parameters:
* {string} orgId - ID associated with the organization
* {string} start - Start of range for payload count query (ms since epoch)
* {string} end - End of range for payload count query (ms since epoch)
* {string} asBytes - If the resulting stats should be returned as bytes
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Payload counts, by type and source (https://api.losant.com/#/definitions/payloadStats)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if organization was not found (https://api.losant.com/#/definitions/error)
'''
pass
def payload_counts_breakdown(self, **kwargs):
'''
Returns payload counts per resolution in the time range specified for all application this organization owns
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.Organization.read, all.User, all.User.read, org.*, or org.payloadCountsBreakdown.
Parameters:
* {string} orgId - ID associated with the organization
* {string} start - Start of range for payload count query (ms since epoch)
* {string} end - End of range for payload count query (ms since epoch)
* {string} resolution - Resolution in milliseconds. Accepted values are: 86400000, 3600000
* {string} asBytes - If the resulting stats should be returned as bytes
* {string} includeNonBillable - If non-billable payloads should be included in the result
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Sum of payload counts by date (https://api.losant.com/#/definitions/payloadCountsBreakdown)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if organization was not found (https://api.losant.com/#/definitions/error)
'''
pass
def pending_invites(self, **kwargs):
'''
Gets the current pending invites
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.Organization.read, all.User, all.User.read, org.*, or org.pendingInvites.
Parameters:
* {string} orgId - ID associated with the organization
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Invitation information (https://api.losant.com/#/definitions/orgInvites)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if organization not found (https://api.losant.com/#/definitions/error)
'''
pass
def remove_member(self, **kwargs):
'''
Removes a member from the org
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.User, org.*, or org.removeMember.
Parameters:
* {string} orgId - ID associated with the organization
* {string} userId - Id of user to remove
* {string} summaryExclude - Comma-separated list of summary fields to exclude from org summary
* {string} summaryInclude - Comma-separated list of summary fields to include in org summary
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated organization information (https://api.losant.com/#/definitions/org)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if organization not found (https://api.losant.com/#/definitions/error)
'''
pass
def revoke_invite(self, **kwargs):
'''
Revokes an existing invite
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.User, org.*, or org.revokeInvite.
Parameters:
* {string} orgId - ID associated with the organization
* {string} inviteId - Id of invite to revoke
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Invitation information (https://api.losant.com/#/definitions/orgInvites)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if organization not found (https://api.losant.com/#/definitions/error)
'''
pass
def transfer_resources(self, **kwargs):
'''
Moves resources to a new owner
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Organization, all.User, org.*, or org.transferResources.
Parameters:
* {string} orgId - ID associated with the organization
* {hash} transfer - Object containing properties of the transfer (https://api.losant.com/#/definitions/resourceTransfer)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If resource transfer was successful (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if organization was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 15 | 14 | 47 | 7 | 20 | 20 | 8 | 0.99 | 1 | 0 | 0 | 0 | 14 | 1 | 14 | 14 | 668 | 118 | 276 | 81 | 261 | 274 | 276 | 81 | 261 | 11 | 1 | 1 | 105 |
147,238 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/instance_custom_node.py
|
platformrest.instance_custom_node.InstanceCustomNode
|
class InstanceCustomNode(object):
""" Class containing all the actions for the Instance Custom Node Resource """
def __init__(self, client):
self.client = client
def delete(self, **kwargs):
"""
Deletes a Custom Node
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.User, instanceCustomNode.*, or instanceCustomNode.delete.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} instanceCustomNodeId - ID associated with the Custom Node
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If Custom Node was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if Custom Node was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "instanceId" in kwargs:
path_params["instanceId"] = kwargs["instanceId"]
if "instanceCustomNodeId" in kwargs:
path_params["instanceCustomNodeId"] = kwargs["instanceCustomNodeId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/instances/{instanceId}/nodes/{instanceCustomNodeId}".format(**path_params)
return self.client.request("DELETE", path, params=query_params, headers=headers, body=body)
def errors(self, **kwargs):
"""
Get information about errors that occurred during runs of this Custom Node
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.Instance.read, all.User, all.User.read, instanceCustomNode.*, or instanceCustomNode.errors.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} instanceCustomNodeId - ID associated with the Custom Node
* {string} duration - Duration of time range in milliseconds
* {string} end - End of time range in milliseconds since epoch
* {string} limit - Maximum number of errors to return
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Custom Node error information (https://api.losant.com/#/definitions/flowErrors)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if Custom Node was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "instanceId" in kwargs:
path_params["instanceId"] = kwargs["instanceId"]
if "instanceCustomNodeId" in kwargs:
path_params["instanceCustomNodeId"] = kwargs["instanceCustomNodeId"]
if "duration" in kwargs:
query_params["duration"] = kwargs["duration"]
if "end" in kwargs:
query_params["end"] = kwargs["end"]
if "limit" in kwargs:
query_params["limit"] = kwargs["limit"]
if "sortDirection" in kwargs:
query_params["sortDirection"] = kwargs["sortDirection"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/instances/{instanceId}/nodes/{instanceCustomNodeId}/errors".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def get(self, **kwargs):
"""
Retrieves information on a Custom Node
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.Instance.read, all.User, all.User.read, instanceCustomNode.*, or instanceCustomNode.get.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} instanceCustomNodeId - ID associated with the Custom Node
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Custom Node information (https://api.losant.com/#/definitions/instanceCustomNode)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if Custom Node was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "instanceId" in kwargs:
path_params["instanceId"] = kwargs["instanceId"]
if "instanceCustomNodeId" in kwargs:
path_params["instanceCustomNodeId"] = kwargs["instanceCustomNodeId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/instances/{instanceId}/nodes/{instanceCustomNodeId}".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def patch(self, **kwargs):
"""
Updates information about a Custom Node
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.User, instanceCustomNode.*, or instanceCustomNode.patch.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} instanceCustomNodeId - ID associated with the Custom Node
* {hash} instanceCustomNode - Object containing new properties of the Custom Node (https://api.losant.com/#/definitions/instanceCustomNodePatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated Custom Node information (https://api.losant.com/#/definitions/instanceCustomNode)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if Custom Node was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "instanceId" in kwargs:
path_params["instanceId"] = kwargs["instanceId"]
if "instanceCustomNodeId" in kwargs:
path_params["instanceCustomNodeId"] = kwargs["instanceCustomNodeId"]
if "instanceCustomNode" in kwargs:
body = kwargs["instanceCustomNode"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/instances/{instanceId}/nodes/{instanceCustomNodeId}".format(**path_params)
return self.client.request("PATCH", path, params=query_params, headers=headers, body=body)
def stats(self, **kwargs):
"""
Get statistics about runs for this Custom Node
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.Instance.read, all.User, all.User.read, instanceCustomNode.*, or instanceCustomNode.stats.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} instanceCustomNodeId - ID associated with the Custom Node
* {string} duration - Duration of time range in milliseconds
* {string} end - End of time range in milliseconds since epoch
* {string} resolution - Resolution in milliseconds
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Statistics for Custom Node runs (https://api.losant.com/#/definitions/flowStats)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if Custom Node was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "instanceId" in kwargs:
path_params["instanceId"] = kwargs["instanceId"]
if "instanceCustomNodeId" in kwargs:
path_params["instanceCustomNodeId"] = kwargs["instanceCustomNodeId"]
if "duration" in kwargs:
query_params["duration"] = kwargs["duration"]
if "end" in kwargs:
query_params["end"] = kwargs["end"]
if "resolution" in kwargs:
query_params["resolution"] = kwargs["resolution"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/instances/{instanceId}/nodes/{instanceCustomNodeId}/stats".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
|
class InstanceCustomNode(object):
''' Class containing all the actions for the Instance Custom Node Resource '''
def __init__(self, client):
pass
def delete(self, **kwargs):
'''
Deletes a Custom Node
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.User, instanceCustomNode.*, or instanceCustomNode.delete.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} instanceCustomNodeId - ID associated with the Custom Node
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If Custom Node was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if Custom Node was not found (https://api.losant.com/#/definitions/error)
'''
pass
def errors(self, **kwargs):
'''
Get information about errors that occurred during runs of this Custom Node
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.Instance.read, all.User, all.User.read, instanceCustomNode.*, or instanceCustomNode.errors.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} instanceCustomNodeId - ID associated with the Custom Node
* {string} duration - Duration of time range in milliseconds
* {string} end - End of time range in milliseconds since epoch
* {string} limit - Maximum number of errors to return
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Custom Node error information (https://api.losant.com/#/definitions/flowErrors)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if Custom Node was not found (https://api.losant.com/#/definitions/error)
'''
pass
def get(self, **kwargs):
'''
Retrieves information on a Custom Node
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.Instance.read, all.User, all.User.read, instanceCustomNode.*, or instanceCustomNode.get.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} instanceCustomNodeId - ID associated with the Custom Node
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Custom Node information (https://api.losant.com/#/definitions/instanceCustomNode)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if Custom Node was not found (https://api.losant.com/#/definitions/error)
'''
pass
def patch(self, **kwargs):
'''
Updates information about a Custom Node
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.User, instanceCustomNode.*, or instanceCustomNode.patch.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} instanceCustomNodeId - ID associated with the Custom Node
* {hash} instanceCustomNode - Object containing new properties of the Custom Node (https://api.losant.com/#/definitions/instanceCustomNodePatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Updated Custom Node information (https://api.losant.com/#/definitions/instanceCustomNode)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if Custom Node was not found (https://api.losant.com/#/definitions/error)
'''
pass
def stats(self, **kwargs):
'''
Get statistics about runs for this Custom Node
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.Instance.read, all.User, all.User.read, instanceCustomNode.*, or instanceCustomNode.stats.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} instanceCustomNodeId - ID associated with the Custom Node
* {string} duration - Duration of time range in milliseconds
* {string} end - End of time range in milliseconds since epoch
* {string} resolution - Resolution in milliseconds
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Statistics for Custom Node runs (https://api.losant.com/#/definitions/flowStats)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if Custom Node was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 7 | 6 | 44 | 7 | 19 | 18 | 7 | 0.96 | 1 | 0 | 0 | 0 | 6 | 1 | 6 | 6 | 269 | 46 | 114 | 33 | 107 | 109 | 114 | 33 | 107 | 11 | 1 | 1 | 44 |
147,239 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/org_invites.py
|
platformrest.org_invites.OrgInvites
|
class OrgInvites(object):
""" Class containing all the actions for the Org Invites Resource """
def __init__(self, client):
self.client = client
def get(self, **kwargs):
"""
Gets information about an invite
Authentication:
No api access token is required to call this action.
Parameters:
* {string} token - The token associated with the invite
* {string} email - The email associated with the invite
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Information about invite (https://api.losant.com/#/definitions/orgInviteInfo)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if invite not found (https://api.losant.com/#/definitions/error)
* 410 - Error if invite has expired (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "token" in kwargs:
query_params["token"] = kwargs["token"]
if "email" in kwargs:
query_params["email"] = kwargs["email"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/invites".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def post(self, **kwargs):
"""
Accepts/Rejects an invite
Authentication:
No api access token is required to call this action.
Parameters:
* {hash} invite - Invite info and acceptance (https://api.losant.com/#/definitions/orgInviteAction)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Acceptance/Rejection of invite (https://api.losant.com/#/definitions/orgInviteResult)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if invite not found (https://api.losant.com/#/definitions/error)
* 410 - Error if invite has expired (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "invite" in kwargs:
body = kwargs["invite"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/invites".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
|
class OrgInvites(object):
''' Class containing all the actions for the Org Invites Resource '''
def __init__(self, client):
pass
def get(self, **kwargs):
'''
Gets information about an invite
Authentication:
No api access token is required to call this action.
Parameters:
* {string} token - The token associated with the invite
* {string} email - The email associated with the invite
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Information about invite (https://api.losant.com/#/definitions/orgInviteInfo)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if invite not found (https://api.losant.com/#/definitions/error)
* 410 - Error if invite has expired (https://api.losant.com/#/definitions/error)
'''
pass
def post(self, **kwargs):
'''
Accepts/Rejects an invite
Authentication:
No api access token is required to call this action.
Parameters:
* {hash} invite - Invite info and acceptance (https://api.losant.com/#/definitions/orgInviteAction)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Acceptance/Rejection of invite (https://api.losant.com/#/definitions/orgInviteResult)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if invite not found (https://api.losant.com/#/definitions/error)
* 410 - Error if invite has expired (https://api.losant.com/#/definitions/error)
'''
pass
| 4 | 3 | 30 | 5 | 13 | 12 | 5 | 0.92 | 1 | 0 | 0 | 0 | 3 | 1 | 3 | 3 | 94 | 19 | 39 | 15 | 35 | 36 | 39 | 15 | 35 | 7 | 1 | 1 | 14 |
147,240 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/application_template.py
|
platformrest.application_template.ApplicationTemplate
|
class ApplicationTemplate(object):
""" Class containing all the actions for the Application Template Resource """
def __init__(self, client):
self.client = client
def get(self, **kwargs):
"""
Retrieves information on an application template
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, all.User.read, applicationTemplate.*, or applicationTemplate.get.
Parameters:
* {string} templateId - ID associated with the template
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Application template information (https://api.losant.com/#/definitions/applicationTemplate)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if template was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "templateId" in kwargs:
path_params["templateId"] = kwargs["templateId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applicationTemplates/{templateId}".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
|
class ApplicationTemplate(object):
''' Class containing all the actions for the Application Template Resource '''
def __init__(self, client):
pass
def get(self, **kwargs):
'''
Retrieves information on an application template
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, all.User.read, applicationTemplate.*, or applicationTemplate.get.
Parameters:
* {string} templateId - ID associated with the template
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Application template information (https://api.losant.com/#/definitions/applicationTemplate)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if template was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 3 | 2 | 23 | 4 | 10 | 10 | 4 | 1 | 1 | 0 | 0 | 0 | 2 | 1 | 2 | 2 | 50 | 10 | 20 | 9 | 17 | 20 | 20 | 9 | 17 | 6 | 1 | 1 | 7 |
147,241 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/application_keys.py
|
platformrest.application_keys.ApplicationKeys
|
class ApplicationKeys(object):
""" Class containing all the actions for the Application Keys Resource """
def __init__(self, client):
self.client = client
def get(self, **kwargs):
"""
Returns the applicationKeys for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, applicationKeys.*, or applicationKeys.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} sortField - Field to sort the results by. Accepted values are: key, status, id, creationDate, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: key, status
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {hash} query - Application key filter JSON object which overrides the filterField and filter parameters. (https://api.losant.com/#/definitions/advancedApplicationKeyQuery)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of applicationKeys (https://api.losant.com/#/definitions/applicationKeys)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "sortField" in kwargs:
query_params["sortField"] = kwargs["sortField"]
if "sortDirection" in kwargs:
query_params["sortDirection"] = kwargs["sortDirection"]
if "page" in kwargs:
query_params["page"] = kwargs["page"]
if "perPage" in kwargs:
query_params["perPage"] = kwargs["perPage"]
if "filterField" in kwargs:
query_params["filterField"] = kwargs["filterField"]
if "filter" in kwargs:
query_params["filter"] = kwargs["filter"]
if "query" in kwargs:
query_params["query"] = json.dumps(kwargs["query"])
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/keys".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def post(self, **kwargs):
"""
Create a new applicationKey for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, applicationKeys.*, or applicationKeys.post.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} applicationKey - ApplicationKey information (https://api.losant.com/#/definitions/applicationKeyPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created applicationKey (https://api.losant.com/#/definitions/applicationKeyPostResponse)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "applicationKey" in kwargs:
body = kwargs["applicationKey"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/keys".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
|
class ApplicationKeys(object):
''' Class containing all the actions for the Application Keys Resource '''
def __init__(self, client):
pass
def get(self, **kwargs):
'''
Returns the applicationKeys for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, applicationKeys.*, or applicationKeys.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} sortField - Field to sort the results by. Accepted values are: key, status, id, creationDate, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: key, status
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {hash} query - Application key filter JSON object which overrides the filterField and filter parameters. (https://api.losant.com/#/definitions/advancedApplicationKeyQuery)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of applicationKeys (https://api.losant.com/#/definitions/applicationKeys)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
def post(self, **kwargs):
'''
Create a new applicationKey for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, applicationKeys.*, or applicationKeys.post.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} applicationKey - ApplicationKey information (https://api.losant.com/#/definitions/applicationKeyPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created applicationKey (https://api.losant.com/#/definitions/applicationKeyPostResponse)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 4 | 3 | 38 | 5 | 17 | 15 | 7 | 0.89 | 1 | 0 | 0 | 0 | 3 | 1 | 3 | 3 | 119 | 19 | 53 | 15 | 49 | 47 | 53 | 15 | 49 | 13 | 1 | 1 | 21 |
147,242 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/instance_audit_log.py
|
platformrest.instance_audit_log.InstanceAuditLog
|
class InstanceAuditLog(object):
""" Class containing all the actions for the Instance Audit Log Resource """
def __init__(self, client):
self.client = client
def get(self, **kwargs):
"""
Retrieves information on an instance audit log
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.Instance.read, all.User, all.User.read, instanceAuditLog.*, or instanceAuditLog.get.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} instanceAuditLogId - ID associated with the instance audit log
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Instance audit log information (https://api.losant.com/#/definitions/instanceAuditLog)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if instance audit log was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "instanceId" in kwargs:
path_params["instanceId"] = kwargs["instanceId"]
if "instanceAuditLogId" in kwargs:
path_params["instanceAuditLogId"] = kwargs["instanceAuditLogId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/instance/{instanceId}/audit-logs/{instanceAuditLogId}".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
|
class InstanceAuditLog(object):
''' Class containing all the actions for the Instance Audit Log Resource '''
def __init__(self, client):
pass
def get(self, **kwargs):
'''
Retrieves information on an instance audit log
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Instance, all.Instance.read, all.User, all.User.read, instanceAuditLog.*, or instanceAuditLog.get.
Parameters:
* {string} instanceId - ID associated with the instance
* {string} instanceAuditLogId - ID associated with the instance audit log
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Instance audit log information (https://api.losant.com/#/definitions/instanceAuditLog)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if instance audit log was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 3 | 2 | 25 | 4 | 11 | 10 | 4 | 0.95 | 1 | 0 | 0 | 0 | 2 | 1 | 2 | 2 | 53 | 10 | 22 | 9 | 19 | 21 | 22 | 9 | 19 | 7 | 1 | 1 | 8 |
147,243 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/orgs.py
|
platformrest.orgs.Orgs
|
class Orgs(object):
""" Class containing all the actions for the Orgs Resource """
def __init__(self, client):
self.client = client
def get(self, **kwargs):
"""
Returns the organizations associated with the current user
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, all.User.read, orgs.*, or orgs.get.
Parameters:
* {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} summaryExclude - Comma-separated list of summary fields to exclude from org summaries
* {string} summaryInclude - Comma-separated list of summary fields to include in org summary
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of organizations (https://api.losant.com/#/definitions/orgs)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "sortField" in kwargs:
query_params["sortField"] = kwargs["sortField"]
if "sortDirection" in kwargs:
query_params["sortDirection"] = kwargs["sortDirection"]
if "page" in kwargs:
query_params["page"] = kwargs["page"]
if "perPage" in kwargs:
query_params["perPage"] = kwargs["perPage"]
if "filterField" in kwargs:
query_params["filterField"] = kwargs["filterField"]
if "filter" in kwargs:
query_params["filter"] = kwargs["filter"]
if "summaryExclude" in kwargs:
query_params["summaryExclude"] = kwargs["summaryExclude"]
if "summaryInclude" in kwargs:
query_params["summaryInclude"] = kwargs["summaryInclude"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/orgs".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def post(self, **kwargs):
"""
Create a new organization
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, orgs.*, or orgs.post.
Parameters:
* {hash} organization - New organization information (https://api.losant.com/#/definitions/orgPost)
* {string} summaryExclude - Comma-separated list of summary fields to exclude from org summary
* {string} summaryInclude - Comma-separated list of summary fields to include in org summary
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created organization (https://api.losant.com/#/definitions/org)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "organization" in kwargs:
body = kwargs["organization"]
if "summaryExclude" in kwargs:
query_params["summaryExclude"] = kwargs["summaryExclude"]
if "summaryInclude" in kwargs:
query_params["summaryInclude"] = kwargs["summaryInclude"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/orgs".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
|
class Orgs(object):
''' Class containing all the actions for the Orgs Resource '''
def __init__(self, client):
pass
def get(self, **kwargs):
'''
Returns the organizations associated with the current user
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, all.User.read, orgs.*, or orgs.get.
Parameters:
* {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} summaryExclude - Comma-separated list of summary fields to exclude from org summaries
* {string} summaryInclude - Comma-separated list of summary fields to include in org summary
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of organizations (https://api.losant.com/#/definitions/orgs)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
'''
pass
def post(self, **kwargs):
'''
Create a new organization
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, orgs.*, or orgs.post.
Parameters:
* {hash} organization - New organization information (https://api.losant.com/#/definitions/orgPost)
* {string} summaryExclude - Comma-separated list of summary fields to exclude from org summary
* {string} summaryInclude - Comma-separated list of summary fields to include in org summary
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created organization (https://api.losant.com/#/definitions/org)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
'''
pass
| 4 | 3 | 38 | 5 | 18 | 15 | 7 | 0.84 | 1 | 0 | 0 | 0 | 3 | 1 | 3 | 3 | 120 | 19 | 55 | 15 | 51 | 46 | 55 | 15 | 51 | 13 | 1 | 1 | 22 |
147,244 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/platform_error.py
|
platformrest.platform_error.PlatformError
|
class PlatformError(Exception):
""" Exception class for any Platform API errors """
def __init__(self, status, data):
Exception.__init__(self)
self.status = status
self.data = data
self.args = [status, data]
def __str__(self):
return str(self.status) + " " + str(self.data)
|
class PlatformError(Exception):
''' Exception class for any Platform API errors '''
def __init__(self, status, data):
pass
def __str__(self):
pass
| 3 | 1 | 4 | 0 | 4 | 0 | 1 | 0.13 | 1 | 1 | 0 | 0 | 2 | 3 | 2 | 12 | 11 | 2 | 8 | 6 | 5 | 1 | 8 | 6 | 5 | 1 | 3 | 0 | 2 |
147,245 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/resource_job.py
|
platformrest.resource_job.ResourceJob
|
class ResourceJob(object):
""" Class containing all the actions for the Resource Job Resource """
def __init__(self, client):
self.client = client
def cancel_execution(self, **kwargs):
"""
Marks a specific resource job execution for cancellation
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, resourceJob.*, or resourceJob.cancelExecution.
Parameters:
* {string} applicationId - ID associated with the application
* {string} resourceJobId - ID associated with the resource job
* {undefined} executionId - The ID of the execution to cancel
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If the execution was successfully marked for cancellation (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if execution was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "resourceJobId" in kwargs:
path_params["resourceJobId"] = kwargs["resourceJobId"]
if "executionId" in kwargs:
query_params["executionId"] = kwargs["executionId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/resource-jobs/{resourceJobId}/cancelExecution".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
def delete(self, **kwargs):
"""
Deletes a resource job
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, resourceJob.*, or resourceJob.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} resourceJobId - ID associated with the resource job
* {string} includeWorkflows - If the workflows that trigger from this resource job should also be deleted.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If resource job was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if resource job was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "resourceJobId" in kwargs:
path_params["resourceJobId"] = kwargs["resourceJobId"]
if "includeWorkflows" in kwargs:
query_params["includeWorkflows"] = kwargs["includeWorkflows"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/resource-jobs/{resourceJobId}".format(**path_params)
return self.client.request("DELETE", path, params=query_params, headers=headers, body=body)
def execute(self, **kwargs):
"""
Queues the execution of a resource job
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, resourceJob.*, or resourceJob.execute.
Parameters:
* {string} applicationId - ID associated with the application
* {string} resourceJobId - ID associated with the resource job
* {hash} executionOptions - The options for the execution (https://api.losant.com/#/definitions/resourceJobExecutionOptions)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If the job was successfully queued (https://api.losant.com/#/definitions/successWithExecutionId)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if resource job was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "resourceJobId" in kwargs:
path_params["resourceJobId"] = kwargs["resourceJobId"]
if "executionOptions" in kwargs:
body = kwargs["executionOptions"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/resource-jobs/{resourceJobId}/execute".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
def get(self, **kwargs):
"""
Returns a resource job
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, resourceJob.*, or resourceJob.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} resourceJobId - ID associated with the resource job
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - A single resource job (https://api.losant.com/#/definitions/resourceJob)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "resourceJobId" in kwargs:
path_params["resourceJobId"] = kwargs["resourceJobId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/resource-jobs/{resourceJobId}".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def logs(self, **kwargs):
"""
Retrieves information on resource job executions
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, resourceJob.*, or resourceJob.logs.
Parameters:
* {string} applicationId - ID associated with the application
* {string} resourceJobId - ID associated with the resource job
* {string} limit - Max log entries to return (ordered by time descending)
* {string} since - Look for log entries since this time (ms since epoch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Resource job execution information (https://api.losant.com/#/definitions/resourceJobExecutionLogs)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if resource job was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "resourceJobId" in kwargs:
path_params["resourceJobId"] = kwargs["resourceJobId"]
if "limit" in kwargs:
query_params["limit"] = kwargs["limit"]
if "since" in kwargs:
query_params["since"] = kwargs["since"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/resource-jobs/{resourceJobId}/logs".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def patch(self, **kwargs):
"""
Update a resource job
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, resourceJob.*, or resourceJob.patch.
Parameters:
* {string} applicationId - ID associated with the application
* {string} resourceJobId - ID associated with the resource job
* {hash} resourceJob - The new resource job configuration (https://api.losant.com/#/definitions/resourceJobPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully updated resource job (https://api.losant.com/#/definitions/resourceJob)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if resource job was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "resourceJobId" in kwargs:
path_params["resourceJobId"] = kwargs["resourceJobId"]
if "resourceJob" in kwargs:
body = kwargs["resourceJob"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/resource-jobs/{resourceJobId}".format(**path_params)
return self.client.request("PATCH", path, params=query_params, headers=headers, body=body)
|
class ResourceJob(object):
''' Class containing all the actions for the Resource Job Resource '''
def __init__(self, client):
pass
def cancel_execution(self, **kwargs):
'''
Marks a specific resource job execution for cancellation
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, resourceJob.*, or resourceJob.cancelExecution.
Parameters:
* {string} applicationId - ID associated with the application
* {string} resourceJobId - ID associated with the resource job
* {undefined} executionId - The ID of the execution to cancel
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If the execution was successfully marked for cancellation (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if execution was not found (https://api.losant.com/#/definitions/error)
'''
pass
def delete(self, **kwargs):
'''
Deletes a resource job
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, resourceJob.*, or resourceJob.delete.
Parameters:
* {string} applicationId - ID associated with the application
* {string} resourceJobId - ID associated with the resource job
* {string} includeWorkflows - If the workflows that trigger from this resource job should also be deleted.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If resource job was successfully deleted (https://api.losant.com/#/definitions/success)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if resource job was not found (https://api.losant.com/#/definitions/error)
'''
pass
def execute(self, **kwargs):
'''
Queues the execution of a resource job
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, resourceJob.*, or resourceJob.execute.
Parameters:
* {string} applicationId - ID associated with the application
* {string} resourceJobId - ID associated with the resource job
* {hash} executionOptions - The options for the execution (https://api.losant.com/#/definitions/resourceJobExecutionOptions)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - If the job was successfully queued (https://api.losant.com/#/definitions/successWithExecutionId)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if resource job was not found (https://api.losant.com/#/definitions/error)
'''
pass
def get(self, **kwargs):
'''
Returns a resource job
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, resourceJob.*, or resourceJob.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} resourceJobId - ID associated with the resource job
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - A single resource job (https://api.losant.com/#/definitions/resourceJob)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
def logs(self, **kwargs):
'''
Retrieves information on resource job executions
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, resourceJob.*, or resourceJob.logs.
Parameters:
* {string} applicationId - ID associated with the application
* {string} resourceJobId - ID associated with the resource job
* {string} limit - Max log entries to return (ordered by time descending)
* {string} since - Look for log entries since this time (ms since epoch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Resource job execution information (https://api.losant.com/#/definitions/resourceJobExecutionLogs)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if resource job was not found (https://api.losant.com/#/definitions/error)
'''
pass
def patch(self, **kwargs):
'''
Update a resource job
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, resourceJob.*, or resourceJob.patch.
Parameters:
* {string} applicationId - ID associated with the application
* {string} resourceJobId - ID associated with the resource job
* {hash} resourceJob - The new resource job configuration (https://api.losant.com/#/definitions/resourceJobPatch)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully updated resource job (https://api.losant.com/#/definitions/resourceJob)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if resource job was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 8 | 7 | 43 | 7 | 18 | 18 | 7 | 0.98 | 1 | 0 | 0 | 0 | 7 | 1 | 7 | 7 | 311 | 55 | 129 | 39 | 121 | 127 | 129 | 39 | 121 | 9 | 1 | 1 | 49 |
147,246 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/application_templates.py
|
platformrest.application_templates.ApplicationTemplates
|
class ApplicationTemplates(object):
""" Class containing all the actions for the Application Templates Resource """
def __init__(self, client):
self.client = client
def get(self, **kwargs):
"""
Returns the application templates the current user has permission to see
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, all.User.read, applicationTemplates.*, or applicationTemplates.get.
Parameters:
* {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name, authorName
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {array} keywords - List of keywords to filter by. Matches all provided keywords.
* {string} categoryId - ID of a category to filter by.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of application templates (https://api.losant.com/#/definitions/applicationTemplates)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "sortField" in kwargs:
query_params["sortField"] = kwargs["sortField"]
if "sortDirection" in kwargs:
query_params["sortDirection"] = kwargs["sortDirection"]
if "page" in kwargs:
query_params["page"] = kwargs["page"]
if "perPage" in kwargs:
query_params["perPage"] = kwargs["perPage"]
if "filterField" in kwargs:
query_params["filterField"] = kwargs["filterField"]
if "filter" in kwargs:
query_params["filter"] = kwargs["filter"]
if "keywords" in kwargs:
query_params["keywords"] = kwargs["keywords"]
if "categoryId" in kwargs:
query_params["categoryId"] = kwargs["categoryId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applicationTemplates".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def get_categories(self, **kwargs):
"""
Returns a category list, beginning at the specified category
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, all.User.read, applicationTemplates.*, or applicationTemplates.getCategories.
Parameters:
* {string} baseId - ID of the category to begin from
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of application categories (https://api.losant.com/#/definitions/applicationTemplateCategories)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "baseId" in kwargs:
query_params["baseId"] = kwargs["baseId"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applicationTemplates/categories".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def get_unique_keywords(self, **kwargs):
"""
Returns an array of all unique keywords currently in use by templates
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, all.User.read, applicationTemplates.*, or applicationTemplates.getUniqueKeywords.
Parameters:
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Array of all unique template keywords (https://api.losant.com/#/definitions/templateKeywords)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applicationTemplates/keywords".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
|
class ApplicationTemplates(object):
''' Class containing all the actions for the Application Templates Resource '''
def __init__(self, client):
pass
def get(self, **kwargs):
'''
Returns the application templates the current user has permission to see
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, all.User.read, applicationTemplates.*, or applicationTemplates.get.
Parameters:
* {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name, authorName
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {array} keywords - List of keywords to filter by. Matches all provided keywords.
* {string} categoryId - ID of a category to filter by.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of application templates (https://api.losant.com/#/definitions/applicationTemplates)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
'''
pass
def get_categories(self, **kwargs):
'''
Returns a category list, beginning at the specified category
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, all.User.read, applicationTemplates.*, or applicationTemplates.getCategories.
Parameters:
* {string} baseId - ID of the category to begin from
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of application categories (https://api.losant.com/#/definitions/applicationTemplateCategories)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
'''
pass
def get_unique_keywords(self, **kwargs):
'''
Returns an array of all unique keywords currently in use by templates
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.User, all.User.read, applicationTemplates.*, or applicationTemplates.getUniqueKeywords.
Parameters:
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Array of all unique template keywords (https://api.losant.com/#/definitions/templateKeywords)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
'''
pass
| 5 | 4 | 37 | 6 | 16 | 15 | 6 | 0.92 | 1 | 0 | 0 | 0 | 4 | 1 | 4 | 4 | 155 | 28 | 66 | 21 | 61 | 61 | 66 | 21 | 61 | 13 | 1 | 1 | 25 |
147,247 |
Losant/losant-rest-python
|
Losant_losant-rest-python/platformrest/application_certificate_authorities.py
|
platformrest.application_certificate_authorities.ApplicationCertificateAuthorities
|
class ApplicationCertificateAuthorities(object):
""" Class containing all the actions for the Application Certificate Authorities Resource """
def __init__(self, client):
self.client = client
def get(self, **kwargs):
"""
Returns the application certificate authorities for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, applicationCertificateAuthorities.*, or applicationCertificateAuthorities.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} sortField - Field to sort the results by. Accepted values are: name, status, id, creationDate, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name, status
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of application certificate authorities (https://api.losant.com/#/definitions/applicationCertificateAuthorities)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "sortField" in kwargs:
query_params["sortField"] = kwargs["sortField"]
if "sortDirection" in kwargs:
query_params["sortDirection"] = kwargs["sortDirection"]
if "page" in kwargs:
query_params["page"] = kwargs["page"]
if "perPage" in kwargs:
query_params["perPage"] = kwargs["perPage"]
if "filterField" in kwargs:
query_params["filterField"] = kwargs["filterField"]
if "filter" in kwargs:
query_params["filter"] = kwargs["filter"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/certificate-authorities".format(**path_params)
return self.client.request("GET", path, params=query_params, headers=headers, body=body)
def post(self, **kwargs):
"""
Create a new application certificate authority for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, applicationCertificateAuthorities.*, or applicationCertificateAuthorities.post.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} applicationCertificateAuthority - Application certificate authority information (https://api.losant.com/#/definitions/applicationCertificateAuthorityPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created application certificate authority (https://api.losant.com/#/definitions/applicationCertificateAuthority)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
"""
query_params = {"_actions": "false", "_links": "true", "_embedded": "true"}
path_params = {}
headers = {}
body = None
if "applicationId" in kwargs:
path_params["applicationId"] = kwargs["applicationId"]
if "applicationCertificateAuthority" in kwargs:
body = kwargs["applicationCertificateAuthority"]
if "losantdomain" in kwargs:
headers["losantdomain"] = kwargs["losantdomain"]
if "_actions" in kwargs:
query_params["_actions"] = kwargs["_actions"]
if "_links" in kwargs:
query_params["_links"] = kwargs["_links"]
if "_embedded" in kwargs:
query_params["_embedded"] = kwargs["_embedded"]
path = "/applications/{applicationId}/certificate-authorities".format(**path_params)
return self.client.request("POST", path, params=query_params, headers=headers, body=body)
|
class ApplicationCertificateAuthorities(object):
''' Class containing all the actions for the Application Certificate Authorities Resource '''
def __init__(self, client):
pass
def get(self, **kwargs):
'''
Returns the application certificate authorities for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, applicationCertificateAuthorities.*, or applicationCertificateAuthorities.get.
Parameters:
* {string} applicationId - ID associated with the application
* {string} sortField - Field to sort the results by. Accepted values are: name, status, id, creationDate, lastUpdated
* {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
* {string} page - Which page of results to return
* {string} perPage - How many items to return per page
* {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name, status
* {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 200 - Collection of application certificate authorities (https://api.losant.com/#/definitions/applicationCertificateAuthorities)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
def post(self, **kwargs):
'''
Create a new application certificate authority for an application
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, applicationCertificateAuthorities.*, or applicationCertificateAuthorities.post.
Parameters:
* {string} applicationId - ID associated with the application
* {hash} applicationCertificateAuthority - Application certificate authority information (https://api.losant.com/#/definitions/applicationCertificateAuthorityPost)
* {string} losantdomain - Domain scope of request (rarely needed)
* {boolean} _actions - Return resource actions in response
* {boolean} _links - Return resource link in response
* {boolean} _embedded - Return embedded resources in response
Responses:
* 201 - Successfully created application certificate authority (https://api.losant.com/#/definitions/applicationCertificateAuthority)
Errors:
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
'''
pass
| 4 | 3 | 37 | 5 | 17 | 15 | 7 | 0.9 | 1 | 0 | 0 | 0 | 3 | 1 | 3 | 3 | 116 | 19 | 51 | 15 | 47 | 46 | 51 | 15 | 47 | 12 | 1 | 1 | 20 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.