Skip to content

Commit

Permalink
Merge pull request #9 from amaratkere/readme-fix
Browse files Browse the repository at this point in the history
Update README.md
  • Loading branch information
jmoschou-mq authored and GitHub Enterprise committed Apr 1, 2019
2 parents 300202e + fb3e0db commit 23e0a66
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions README.md
Expand Up @@ -66,25 +66,21 @@ client.chargebacks(token).transitions

There are multiple ways to retrieve collections of objects, depending on your use case. The library will intelligently handle pagination for you, unless you request a specific page of data.

To simply retrieve every object in a collection, call `list()` on the resource.
To simply retrieve every object in a collection, call `list(limit=None)` on the resource.

```
users = client.users.list()
users = client.users.list(limit=None)
```

If an integer is specified for 'limit', the library will return up to maximum of `limit` objects. The default value of `limit` is typically `None`, however for `client.users.list()` and `client.card_products.list()` the default limits are 1000 and 25 respectively.

The `stream()` method returns a generator that efficiently downloads subsequent pages as needed, as opposed to downloading all objects into memory at once.

```
for user in client.users.stream():
pass
```

`list()` accept a `limit` parameter. If specified, the library will return up to maximum of `limit` objects. The default value of `limit` is `None`.

```
client.users.list(limit=20)
```

To retrieve a single page, call the `page()` method specifying `start_index` and `count`.

```
Expand All @@ -104,16 +100,8 @@ See [Sorting & Pagination](https://www.marqeta.com/api/docs/Vh2cbhwAAMsAF3db/sor

Most methods support specifying additional query parameters as a `params` dictionary. The keys and values are the same as the HTTP API.


[Field filtering](https://www.marqeta.com/api/docs/Vh2clxwAAB8AF3hh/field-filtering):
```
client.users.list(params={'fields': 'field_1,field_2'})
```

[Object expansion](https://www.marqeta.com/api/docs/WObAlCkAAENCbcqA/object-expansion):

```
client.cards.list(params={'expand': 'user'})
client.cards.find_show_pan(card_token, params={'show_cvv_number': True})
```

### Finding a specific objects
Expand Down Expand Up @@ -467,7 +455,7 @@ card_product = client.card_products.save(token, {...})

```
# List cards by last 4
cards = client.cards.list()
cards = client.cards.list(last_four='6789')
for card in client.cards.stream():
pass
cards_page = client.cards.page()
Expand All @@ -483,7 +471,7 @@ card = client.cards.find(token)
# Returns a specific card - PAN visible
card = client.cards.find_show_pan(token)
# Returns a card metadata
# Retrieve a card by its barcode
card = client.cards.find_by_barcode(barcode)
# Creates a card
Expand Down

0 comments on commit 23e0a66

Please sign in to comment.