Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] Add "list child users" code examples #121

Merged
merged 2 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading