From 27bd7bfce44de4e83b0aa655a3e985357426d2bf Mon Sep 17 00:00:00 2001 From: Danilo Caballero Chinchilla Date: Thu, 28 Sep 2023 11:22:53 -0700 Subject: [PATCH 01/10] Add missing API key retrieval examples --- official/docs/csharp/current/api-keys/retrieve.cs | 5 +++++ official/docs/java/current/api-keys/retrieve.java | 5 +++++ official/docs/node/current/api-keys/retrieve.js | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/official/docs/csharp/current/api-keys/retrieve.cs b/official/docs/csharp/current/api-keys/retrieve.cs index 934c82f4..8c5db2d5 100644 --- a/official/docs/csharp/current/api-keys/retrieve.cs +++ b/official/docs/csharp/current/api-keys/retrieve.cs @@ -18,6 +18,11 @@ public static async Task Main() List apiKeys = await client.ApiKey.All(); Console.WriteLine(JsonConvert.SerializeObject(apiKeys, Formatting.Indented)); + + // Retrieve API keys for a specific child user + List childApiKeys = await client.ApiKey.RetrieveApiKeysForUser("user_..."); + + Console.WriteLine(JsonConvert.SerializeObject(childApiKeys, Formatting.Indented)); } } } diff --git a/official/docs/java/current/api-keys/retrieve.java b/official/docs/java/current/api-keys/retrieve.java index 3abf0440..e9cee2d4 100644 --- a/official/docs/java/current/api-keys/retrieve.java +++ b/official/docs/java/current/api-keys/retrieve.java @@ -11,5 +11,10 @@ public static void main(String[] args) throws EasyPostException { ApiKeys parentKeys = client.apikeys.all(); System.out.println(parentKeys); + + // Retrieve API keys for a specific child user + ApiKeys childKeys = client.user.apiKeys("user_..."); + + System.out.println(childKeys); } } diff --git a/official/docs/node/current/api-keys/retrieve.js b/official/docs/node/current/api-keys/retrieve.js index 8b3a2bfc..524f1d77 100644 --- a/official/docs/node/current/api-keys/retrieve.js +++ b/official/docs/node/current/api-keys/retrieve.js @@ -9,7 +9,7 @@ const client = new EasyPostClient(process.env.EASYPOST_API_KEY); apiKeys = await client.ApiKey.all(); // Retrieve API keys for a specific child user - apiKeys = await client.User.retrieve('user_...'); + api.User.apiKeys('user_...').then((childApiKeys) => console.log(childApiKeys)); console.log(apiKeys); })(); From 5e1279710ae970c945c29ce0eb7f702ad6c590fc Mon Sep 17 00:00:00 2001 From: Danilo Caballero Chinchilla Date: Thu, 28 Sep 2023 11:30:35 -0700 Subject: [PATCH 02/10] Typo --- official/docs/node/current/api-keys/retrieve.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/official/docs/node/current/api-keys/retrieve.js b/official/docs/node/current/api-keys/retrieve.js index 524f1d77..19c36d6c 100644 --- a/official/docs/node/current/api-keys/retrieve.js +++ b/official/docs/node/current/api-keys/retrieve.js @@ -9,7 +9,7 @@ const client = new EasyPostClient(process.env.EASYPOST_API_KEY); apiKeys = await client.ApiKey.all(); // Retrieve API keys for a specific child user - api.User.apiKeys('user_...').then((childApiKeys) => console.log(childApiKeys)); + client.User.apiKeys('user_...').then((childApiKeys) => console.log(childApiKeys)); console.log(apiKeys); })(); From 196119aac6398e9ebd3365c534843cd50b068e48 Mon Sep 17 00:00:00 2001 From: Danilo Caballero Chinchilla Date: Thu, 28 Sep 2023 13:21:16 -0700 Subject: [PATCH 03/10] Use the right service to retrieve API keys --- official/docs/php/current/api-keys/retrieve.php | 8 +++++--- official/docs/python/current/api-keys/retrieve.py | 8 +++++--- official/docs/ruby/current/api-keys/retrieve.rb | 8 +++++--- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/official/docs/php/current/api-keys/retrieve.php b/official/docs/php/current/api-keys/retrieve.php index 8ddbbd96..7677242f 100644 --- a/official/docs/php/current/api-keys/retrieve.php +++ b/official/docs/php/current/api-keys/retrieve.php @@ -3,10 +3,12 @@ $client = new \EasyPost\EasyPostClient(getenv('EASYPOST_API_KEY')); // Retrieve all API keys (authenticated user and child user keys) -$apiKeys = $client->user->allApiKeys(); +$apiKeys = $client->apiKeys->all(); + +echo $apiKeys; // Retrieve API keys for a child user $childUser = $client->user->retrieve('user_...'); -$apiKeys = $client->user->apiKeys($childUser->id); +$childApiKeys = $client->apiKeys->retrieveApiKeysForUser($childUser->id); -echo $apiKeys; +echo $childApiKeys; diff --git a/official/docs/python/current/api-keys/retrieve.py b/official/docs/python/current/api-keys/retrieve.py index 8d5dc523..c1a80b2e 100644 --- a/official/docs/python/current/api-keys/retrieve.py +++ b/official/docs/python/current/api-keys/retrieve.py @@ -4,10 +4,12 @@ client = easypost.EasyPostClient(os.getenv("EASYPOST_API_KEY")) # Retrieve all API keys (authenticated user and child user keys) -api_keys = client.user.all_api_keys() +api_keys = client.api_key.all() + +print(api_keys) # Retrieve API keys for a child user child_user = client.user.retrieve("user_...") -api_keys = client.user.api_keys(child_user.id) +child_api_keys = client.api_key.retrieve_api_keys_for_user(child_user.id) -print(api_keys) +print(child_api_keys) diff --git a/official/docs/ruby/current/api-keys/retrieve.rb b/official/docs/ruby/current/api-keys/retrieve.rb index 2915b4d8..c0be64d3 100644 --- a/official/docs/ruby/current/api-keys/retrieve.rb +++ b/official/docs/ruby/current/api-keys/retrieve.rb @@ -3,10 +3,12 @@ client = EasyPost::Client.new(api_key: ENV['EASYPOST_API_KEY']) # Retrieve all API keys (authenticated user and child user keys) -api_keys = client.user.all_api_keys +api_keys = client.api_key.all + +puts api_keys # Retrieve API keys for a child user child_user = client.user.retrieve('user_...') -api_keys = client.user.api_keys(child_user.id) +child_api_keys = client.api_key.retrieve_api_keys_for_user(child_user.id) -puts api_keys +puts child_api_keys From bd3e9ec808c7b7295c9b28c1c82472158220d138 Mon Sep 17 00:00:00 2001 From: Danilo Caballero Chinchilla Date: Thu, 28 Sep 2023 13:39:11 -0700 Subject: [PATCH 04/10] Update location of call for Node --- official/docs/node/current/api-keys/retrieve.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/official/docs/node/current/api-keys/retrieve.js b/official/docs/node/current/api-keys/retrieve.js index 19c36d6c..912639cf 100644 --- a/official/docs/node/current/api-keys/retrieve.js +++ b/official/docs/node/current/api-keys/retrieve.js @@ -3,13 +3,13 @@ const EasyPostClient = require('@easypost/api'); const client = new EasyPostClient(process.env.EASYPOST_API_KEY); (async () => { - let apiKeys; - // Retrieve all API keys including children - apiKeys = await client.ApiKey.all(); + let apiKeys = await client.ApiKey.all(); + + console.log(apiKeys); // Retrieve API keys for a specific child user - client.User.apiKeys('user_...').then((childApiKeys) => console.log(childApiKeys)); + let childApiKeys = await client.ApiKey.retrieveApiKeysForUser('user_...'); - console.log(apiKeys); + console.log(childApiKeys); })(); From f81471100d6d56b28fd0297e9d25543124e5b582 Mon Sep 17 00:00:00 2001 From: Danilo Caballero Chinchilla Date: Thu, 28 Sep 2023 14:02:13 -0700 Subject: [PATCH 05/10] Change method location in Java examples --- official/docs/java/current/api-keys/retrieve.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/official/docs/java/current/api-keys/retrieve.java b/official/docs/java/current/api-keys/retrieve.java index e9cee2d4..d9d63733 100644 --- a/official/docs/java/current/api-keys/retrieve.java +++ b/official/docs/java/current/api-keys/retrieve.java @@ -8,12 +8,12 @@ public class Retrieve { public static void main(String[] args) throws EasyPostException { EasyPostClient client = new EasyPostClient(System.getenv("EASYPOST_API_KEY")); - ApiKeys parentKeys = client.apikeys.all(); + ApiKeys parentKeys = client.apiKey.all(); System.out.println(parentKeys); // Retrieve API keys for a specific child user - ApiKeys childKeys = client.user.apiKeys("user_..."); + ApiKeys childKeys = client.apiKey.retrieveApiKeysForUser("user_..."); System.out.println(childKeys); } From 2eefe4f688f89bc72044a42bafb25ae82f0ed181 Mon Sep 17 00:00:00 2001 From: Danilo Caballero Chinchilla Date: Wed, 4 Oct 2023 09:59:20 -0700 Subject: [PATCH 06/10] Add Go examples; make all examples uniform --- official/docs/csharp/current/api-keys/retrieve.cs | 1 + official/docs/golang/current/api-keys/retrieve.go | 6 ++++++ official/docs/java/current/api-keys/retrieve.java | 1 + official/docs/php/current/api-keys/retrieve.php | 4 ++-- official/docs/python/current/api-keys/retrieve.py | 4 ++-- official/docs/ruby/current/api-keys/retrieve.rb | 4 ++-- 6 files changed, 14 insertions(+), 6 deletions(-) diff --git a/official/docs/csharp/current/api-keys/retrieve.cs b/official/docs/csharp/current/api-keys/retrieve.cs index 8c5db2d5..1565117b 100644 --- a/official/docs/csharp/current/api-keys/retrieve.cs +++ b/official/docs/csharp/current/api-keys/retrieve.cs @@ -15,6 +15,7 @@ public static async Task Main() var client = new EasyPost.Client(apiKey); + // Retrieve all API keys including children List apiKeys = await client.ApiKey.All(); Console.WriteLine(JsonConvert.SerializeObject(apiKeys, Formatting.Indented)); diff --git a/official/docs/golang/current/api-keys/retrieve.go b/official/docs/golang/current/api-keys/retrieve.go index dee825b2..11cd419a 100644 --- a/official/docs/golang/current/api-keys/retrieve.go +++ b/official/docs/golang/current/api-keys/retrieve.go @@ -11,7 +11,13 @@ func main() { apiKey := os.Getenv("EASYPOST_API_KEY") client := easypost.New(apiKey) + // Retrieve all API keys including children apiKeys, _ := client.GetAPIKeys() fmt.Println(apiKeys) + + // Retrieve API keys for a specific child user + childApiKeys, _ := client.GetAPIKeysForUser("user_...") + + fmt.Println(childApiKeys) } diff --git a/official/docs/java/current/api-keys/retrieve.java b/official/docs/java/current/api-keys/retrieve.java index d9d63733..54e0ae09 100644 --- a/official/docs/java/current/api-keys/retrieve.java +++ b/official/docs/java/current/api-keys/retrieve.java @@ -8,6 +8,7 @@ public class Retrieve { public static void main(String[] args) throws EasyPostException { EasyPostClient client = new EasyPostClient(System.getenv("EASYPOST_API_KEY")); + // Retrieve all API keys including children ApiKeys parentKeys = client.apiKey.all(); System.out.println(parentKeys); diff --git a/official/docs/php/current/api-keys/retrieve.php b/official/docs/php/current/api-keys/retrieve.php index 7677242f..4bff8df7 100644 --- a/official/docs/php/current/api-keys/retrieve.php +++ b/official/docs/php/current/api-keys/retrieve.php @@ -2,12 +2,12 @@ $client = new \EasyPost\EasyPostClient(getenv('EASYPOST_API_KEY')); -// Retrieve all API keys (authenticated user and child user keys) +// Retrieve all API keys including children $apiKeys = $client->apiKeys->all(); echo $apiKeys; -// Retrieve API keys for a child user +// Retrieve API keys for a specific child user $childUser = $client->user->retrieve('user_...'); $childApiKeys = $client->apiKeys->retrieveApiKeysForUser($childUser->id); diff --git a/official/docs/python/current/api-keys/retrieve.py b/official/docs/python/current/api-keys/retrieve.py index c1a80b2e..733069fe 100644 --- a/official/docs/python/current/api-keys/retrieve.py +++ b/official/docs/python/current/api-keys/retrieve.py @@ -3,12 +3,12 @@ client = easypost.EasyPostClient(os.getenv("EASYPOST_API_KEY")) -# Retrieve all API keys (authenticated user and child user keys) +# Retrieve all API keys including children api_keys = client.api_key.all() print(api_keys) -# Retrieve API keys for a child user +# Retrieve API keys for a specific child user child_user = client.user.retrieve("user_...") child_api_keys = client.api_key.retrieve_api_keys_for_user(child_user.id) diff --git a/official/docs/ruby/current/api-keys/retrieve.rb b/official/docs/ruby/current/api-keys/retrieve.rb index c0be64d3..8c08d0a9 100644 --- a/official/docs/ruby/current/api-keys/retrieve.rb +++ b/official/docs/ruby/current/api-keys/retrieve.rb @@ -2,12 +2,12 @@ client = EasyPost::Client.new(api_key: ENV['EASYPOST_API_KEY']) -# Retrieve all API keys (authenticated user and child user keys) +# Retrieve all API keys including children api_keys = client.api_key.all puts api_keys -# Retrieve API keys for a child user +# Retrieve API keys for a specific child user child_user = client.user.retrieve('user_...') child_api_keys = client.api_key.retrieve_api_keys_for_user(child_user.id) From b3b029faf192f771e7561f5545c0bffd28774962 Mon Sep 17 00:00:00 2001 From: Danilo Caballero Chinchilla Date: Wed, 11 Oct 2023 12:44:44 -0500 Subject: [PATCH 07/10] Bump easypost-go --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 64331361..a558e6de 100644 --- a/go.mod +++ b/go.mod @@ -4,5 +4,5 @@ go 1.15 require ( github.com/EasyPost/easypost-go/v2 v2.20.0 - github.com/EasyPost/easypost-go/v3 v3.0.0 + github.com/EasyPost/easypost-go/v3 v3.2.0 ) From f3c177b333fce7520bea2ee22a60f74a79f2df4c Mon Sep 17 00:00:00 2001 From: Danilo Caballero Chinchilla Date: Wed, 11 Oct 2023 12:49:04 -0500 Subject: [PATCH 08/10] Run go mod --- go.sum | 2 ++ 1 file changed, 2 insertions(+) diff --git a/go.sum b/go.sum index cc894f6e..037001b9 100644 --- a/go.sum +++ b/go.sum @@ -2,6 +2,8 @@ github.com/EasyPost/easypost-go/v2 v2.20.0 h1:DSqpwwTq2XDLg3Nlfk9KSoMHNEyZsqJSyM github.com/EasyPost/easypost-go/v2 v2.20.0/go.mod h1:+C9K2M4jvFSvN06xYXM2qom4zxmxPDTObQHu++C3hCs= github.com/EasyPost/easypost-go/v3 v3.0.0 h1:MVyYFFAIJyQdiZFTejmNlIqwaQGeVilQkVyxpwPxutU= github.com/EasyPost/easypost-go/v3 v3.0.0/go.mod h1:WDD0qkjwxedVKFXCcdJBz22rtRHpuxjGazgSVcTfdIw= +github.com/EasyPost/easypost-go/v3 v3.2.0 h1:dNWmPG1AkpgYFJxhw/zGzCz1JOVXPpNIi8+JND4UHzk= +github.com/EasyPost/easypost-go/v3 v3.2.0/go.mod h1:WDD0qkjwxedVKFXCcdJBz22rtRHpuxjGazgSVcTfdIw= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= From b6d387f77b0ee34115a0b7f94cb17ebca536a64b Mon Sep 17 00:00:00 2001 From: Danilo Caballero Chinchilla Date: Wed, 11 Oct 2023 12:55:42 -0500 Subject: [PATCH 09/10] go mod tidy --- go.sum | 2 -- 1 file changed, 2 deletions(-) diff --git a/go.sum b/go.sum index 037001b9..78872aaa 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,5 @@ github.com/EasyPost/easypost-go/v2 v2.20.0 h1:DSqpwwTq2XDLg3Nlfk9KSoMHNEyZsqJSyMrH2ghjAmc= github.com/EasyPost/easypost-go/v2 v2.20.0/go.mod h1:+C9K2M4jvFSvN06xYXM2qom4zxmxPDTObQHu++C3hCs= -github.com/EasyPost/easypost-go/v3 v3.0.0 h1:MVyYFFAIJyQdiZFTejmNlIqwaQGeVilQkVyxpwPxutU= -github.com/EasyPost/easypost-go/v3 v3.0.0/go.mod h1:WDD0qkjwxedVKFXCcdJBz22rtRHpuxjGazgSVcTfdIw= github.com/EasyPost/easypost-go/v3 v3.2.0 h1:dNWmPG1AkpgYFJxhw/zGzCz1JOVXPpNIi8+JND4UHzk= github.com/EasyPost/easypost-go/v3 v3.2.0/go.mod h1:WDD0qkjwxedVKFXCcdJBz22rtRHpuxjGazgSVcTfdIw= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= From 65d096945b7b6143128542669e252c617b3486a3 Mon Sep 17 00:00:00 2001 From: Danilo Caballero Chinchilla Date: Wed, 11 Oct 2023 13:10:06 -0500 Subject: [PATCH 10/10] Simplify PHP, Python and Ruby examples --- official/docs/php/current/api-keys/retrieve.php | 3 +-- official/docs/python/current/api-keys/retrieve.py | 3 +-- official/docs/ruby/current/api-keys/retrieve.rb | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/official/docs/php/current/api-keys/retrieve.php b/official/docs/php/current/api-keys/retrieve.php index 4bff8df7..ecb9a190 100644 --- a/official/docs/php/current/api-keys/retrieve.php +++ b/official/docs/php/current/api-keys/retrieve.php @@ -8,7 +8,6 @@ echo $apiKeys; // Retrieve API keys for a specific child user -$childUser = $client->user->retrieve('user_...'); -$childApiKeys = $client->apiKeys->retrieveApiKeysForUser($childUser->id); +$childApiKeys = $client->apiKeys->retrieveApiKeysForUser('user_...'); echo $childApiKeys; diff --git a/official/docs/python/current/api-keys/retrieve.py b/official/docs/python/current/api-keys/retrieve.py index 733069fe..0214d1bd 100644 --- a/official/docs/python/current/api-keys/retrieve.py +++ b/official/docs/python/current/api-keys/retrieve.py @@ -9,7 +9,6 @@ print(api_keys) # Retrieve API keys for a specific child user -child_user = client.user.retrieve("user_...") -child_api_keys = client.api_key.retrieve_api_keys_for_user(child_user.id) +child_api_keys = client.api_key.retrieve_api_keys_for_user("user_...") print(child_api_keys) diff --git a/official/docs/ruby/current/api-keys/retrieve.rb b/official/docs/ruby/current/api-keys/retrieve.rb index 8c08d0a9..3a582be6 100644 --- a/official/docs/ruby/current/api-keys/retrieve.rb +++ b/official/docs/ruby/current/api-keys/retrieve.rb @@ -8,7 +8,6 @@ puts api_keys # Retrieve API keys for a specific child user -child_user = client.user.retrieve('user_...') -child_api_keys = client.api_key.retrieve_api_keys_for_user(child_user.id) +child_api_keys = client.api_key.retrieve_api_keys_for_user('user_...') puts child_api_keys