rbw / aiosnow

Asynchronous ServiceNow Library
MIT License
74 stars 12 forks source link

Changed names to make example more clear #23

Closed manvillej closed 4 years ago

manvillej commented 4 years ago

I think this example is a little bit clearer. Clarifying that (what was Incident) is a schema and can be reused multiple times.

codecov-io commented 4 years ago

Codecov Report

Merging #23 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #23   +/-   ##
=====================================
  Coverage     0.3%   0.3%           
=====================================
  Files          36     36           
  Lines         650    650           
=====================================
  Hits            2      2           
  Misses        648    648

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 0191433...59ba172. Read the comment docs.

manvillej commented 4 years ago

@rbw I think this should be all set

rbw commented 4 years ago

Sorry about that delay.

The examples are clearer in 0.3 thanks to the introduction of built-in schemas and the Snow.get_table method.

An example from: https://github.com/rbw/snow/blob/master/examples/table/read/one.py

from snow.schemas.table import IncidentSchema as Incident

async def main(app):
    async with app.get_table(Incident) as inc:
        response = await inc.get_one(Incident.number == "INC0010240")
        print(response["description"])

Thanks for the suggestion.