Skip to content

Commit

Permalink
[chore] Add "list child users" code examples (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
nwithan8 authored Jan 25, 2024
1 parent 036f84c commit 2f162ee
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 0 deletions.
29 changes: 29 additions & 0 deletions official/docs/csharp/current/child-users/list.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Newtonsoft.Json;
using EasyPost;
using EasyPost.Models.API;
using EasyPost.Parameters;

namespace EasyPostExamples
{
public class Examples
{
public static async Task Main()
{
string apiKey = Environment.GetEnvironmentVariable("EASYPOST_API_KEY")!;

var client = new EasyPost.Client(apiKey);

Parameters.Users.AllChildren parameters = new()
{
PageSize = 5
};

ChildUserCollection childUserCollection = await client.User.AllChildren(parameters);

Console.WriteLine(JsonConvert.SerializeObject(childUserCollection, Formatting.Indented));
}
}
}
2 changes: 2 additions & 0 deletions official/docs/curl/current/child-users/list.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
curl -X GET https://api.easypost.com/v2/users/children?page_size=5 \
-u "$EASYPOST_API_KEY":
21 changes: 21 additions & 0 deletions official/docs/golang/current/child-users/list.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package example

import (
"fmt"
"os"

"github.com/EasyPost/easypost-go/v3"
)

func main() {
apiKey := os.Getenv("EASYPOST_API_KEY")
client := easypost.New(apiKey)

childUsers, _ := client.ListChildUsers(
&easypost.ListOptions{
PageSize: 5,
},
)

fmt.Println(childUsers)
}
11 changes: 11 additions & 0 deletions official/docs/node/current/child-users/list.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const EasyPostClient = require('@easypost/api');

const client = new EasyPostClient(process.env.EASYPOST_API_KEY);

(async () => {
const childUsers = await client.User.allChildren({
page_size: 5,
});

console.log(childUsers);
})();
9 changes: 9 additions & 0 deletions official/docs/php/current/child-users/list.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

$client = new \EasyPost\EasyPostClient(getenv('EASYPOST_API_KEY'));

$childUsers = $client->user->allChildren([
'page_size' => 5
]);

echo $childUsers;
8 changes: 8 additions & 0 deletions official/docs/python/current/child-users/list.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import easypost
import os

client = easypost.EasyPostClient(os.getenv("EASYPOST_API_KEY"))

childUsers = client.user.all_children(page_size=5)

print(childUsers)
9 changes: 9 additions & 0 deletions official/docs/ruby/current/child-users/list.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
require 'easypost'

client = EasyPost::Client.new(api_key: ENV['EASYPOST_API_KEY'])

child_users = client.user.all_children(
page_size: 5,
)

puts child_users

0 comments on commit 2f162ee

Please sign in to comment.