-
Notifications
You must be signed in to change notification settings - Fork 8
feat: add create, delete, enable, and disable api keys examples #245
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
Merged
+386
−93
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| using System; | ||
| using System.Threading.Tasks; | ||
| using EasyPost; | ||
| using EasyPost.Models.API; | ||
| using Newtonsoft.Json; | ||
|
|
||
| namespace EasyPostExamples | ||
| { | ||
| public class Examples | ||
| { | ||
| public static async Task Main() | ||
| { | ||
| var client = new EasyPost.Client(new EasyPost.ClientConfiguration("EASYPOST_API_KEY")); | ||
|
|
||
| ApiKey apiKey = await client.ApiKey.Create("test"); | ||
|
|
||
| Console.WriteLine(JsonConvert.SerializeObject(apiKey, Formatting.Indented)); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| using System.Threading.Tasks; | ||
| using EasyPost; | ||
|
|
||
| namespace EasyPostExamples | ||
| { | ||
| public class Examples | ||
| { | ||
| public static async Task Main() | ||
| { | ||
| var client = new EasyPost.Client(new EasyPost.ClientConfiguration("EASYPOST_API_KEY")); | ||
|
|
||
| await client.ApiKey.Delete("ak_..."); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| using System; | ||
| using System.Threading.Tasks; | ||
| using EasyPost; | ||
| using EasyPost.Models.API; | ||
| using Newtonsoft.Json; | ||
|
|
||
| namespace EasyPostExamples | ||
| { | ||
| public class Examples | ||
| { | ||
| public static async Task Main() | ||
| { | ||
| var client = new EasyPost.Client(new EasyPost.ClientConfiguration("EASYPOST_API_KEY")); | ||
|
|
||
| ApiKey apiKey = await client.ApiKey.Disable("ak_..."); | ||
|
|
||
| Console.WriteLine(JsonConvert.SerializeObject(apiKey, Formatting.Indented)); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| using System; | ||
| using System.Threading.Tasks; | ||
| using EasyPost; | ||
| using EasyPost.Models.API; | ||
| using Newtonsoft.Json; | ||
|
|
||
| namespace EasyPostExamples | ||
| { | ||
| public class Examples | ||
| { | ||
| public static async Task Main() | ||
| { | ||
| var client = new EasyPost.Client(new EasyPost.ClientConfiguration("EASYPOST_API_KEY")); | ||
|
|
||
| ApiKey apiKey = await client.ApiKey.Enable("ak_..."); | ||
|
|
||
| Console.WriteLine(JsonConvert.SerializeObject(apiKey, Formatting.Indented)); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| package example | ||
|
|
||
| import ( | ||
| "fmt" | ||
|
|
||
| "github.com/EasyPost/easypost-go/v5" | ||
| ) | ||
|
|
||
| func create() { | ||
| client := easypost.New("EASYPOST_API_KEY") | ||
|
|
||
| apiKey, _ := client.CreateAPIKey("test") | ||
|
|
||
| fmt.Println(apiKey) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| package example | ||
|
|
||
| import ( | ||
| "fmt" | ||
|
|
||
| "github.com/EasyPost/easypost-go/v5" | ||
| ) | ||
|
|
||
| func delete() { | ||
| client := easypost.New("EASYPOST_API_KEY") | ||
|
|
||
| err := client.DeleteAPIKey("ak_...") | ||
|
|
||
| fmt.Println(err) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| package example | ||
|
|
||
| import ( | ||
| "fmt" | ||
|
|
||
| "github.com/EasyPost/easypost-go/v5" | ||
| ) | ||
|
|
||
| func disable() { | ||
| client := easypost.New("EASYPOST_API_KEY") | ||
|
|
||
| apiKey, _ := client.DisableAPIKey("ak_...") | ||
|
|
||
| fmt.Println(apiKey) | ||
|
Justintime50 marked this conversation as resolved.
Dismissed
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| package example | ||
|
|
||
| import ( | ||
| "fmt" | ||
|
|
||
| "github.com/EasyPost/easypost-go/v5" | ||
| ) | ||
|
|
||
| func enable() { | ||
| client := easypost.New("EASYPOST_API_KEY") | ||
|
|
||
| apiKey, _ := client.EnableAPIKey("ak_...") | ||
|
|
||
| fmt.Println(apiKey) | ||
|
Justintime50 marked this conversation as resolved.
Dismissed
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| package api_keys; | ||
|
|
||
| import com.easypost.exception.EasyPostException; | ||
| import com.easypost.model.ApiKey; | ||
| import com.easypost.service.EasyPostClient; | ||
|
|
||
| public class Create { | ||
| public static void main(String[] args) throws EasyPostException { | ||
| EasyPostClient client = new EasyPostClient("EASYPOST_API_KEY"); | ||
|
|
||
| ApiKey apiKey = client.apiKey.create("test"); | ||
|
|
||
| System.out.println(apiKey); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| package api_keys; | ||
|
|
||
| import com.easypost.exception.EasyPostException; | ||
| import com.easypost.service.EasyPostClient; | ||
|
|
||
| public class Delete { | ||
| public static void main(String[] args) throws EasyPostException { | ||
| EasyPostClient client = new EasyPostClient("EASYPOST_API_KEY"); | ||
|
|
||
| client.apiKey.delete("ak_..."); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| package api_keys; | ||
|
|
||
| import com.easypost.exception.EasyPostException; | ||
| import com.easypost.model.ApiKey; | ||
| import com.easypost.service.EasyPostClient; | ||
|
|
||
| public class Disable { | ||
| public static void main(String[] args) throws EasyPostException { | ||
| EasyPostClient client = new EasyPostClient("EASYPOST_API_KEY"); | ||
|
|
||
| ApiKey apiKey = client.apiKey.disable("ak_..."); | ||
|
|
||
| System.out.println(apiKey); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| package api_keys; | ||
|
|
||
| import com.easypost.exception.EasyPostException; | ||
| import com.easypost.model.ApiKey; | ||
| import com.easypost.service.EasyPostClient; | ||
|
|
||
| public class Enable { | ||
| public static void main(String[] args) throws EasyPostException { | ||
| EasyPostClient client = new EasyPostClient("EASYPOST_API_KEY"); | ||
|
|
||
| ApiKey apiKey = client.apiKey.enable("ak_..."); | ||
|
|
||
| System.out.println(apiKey); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| const EasyPostClient = require('@easypost/api'); | ||
|
|
||
| const client = new EasyPostClient('EASYPOST_API_KEY'); | ||
|
|
||
| (async () => { | ||
| const apiKey = await client.ApiKey.create('test'); | ||
|
|
||
| console.log(apiKey); | ||
|
Justintime50 marked this conversation as resolved.
Dismissed
|
||
| })(); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| const EasyPostClient = require('@easypost/api'); | ||
|
|
||
| const client = new EasyPostClient('EASYPOST_API_KEY'); | ||
|
|
||
| (async () => { | ||
| await client.ApiKey.delete('ak_...'); | ||
| })(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| const EasyPostClient = require('@easypost/api'); | ||
|
|
||
| const client = new EasyPostClient('EASYPOST_API_KEY'); | ||
|
|
||
| (async () => { | ||
| const apiKey = await client.ApiKey.disable('ak_...'); | ||
|
|
||
| console.log(apiKey); | ||
|
Justintime50 marked this conversation as resolved.
Dismissed
|
||
| })(); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| const EasyPostClient = require('@easypost/api'); | ||
|
|
||
| const client = new EasyPostClient('EASYPOST_API_KEY'); | ||
|
|
||
| (async () => { | ||
| const apiKey = await client.ApiKey.enable('ak_...'); | ||
|
|
||
| console.log(apiKey); | ||
|
Justintime50 marked this conversation as resolved.
Dismissed
|
||
| })(); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| <?php | ||
|
|
||
| $client = new \EasyPost\EasyPostClient('EASYPOST_API_KEY'); | ||
|
|
||
| $apiKey = $client->apiKeys->create('test'); | ||
|
|
||
| echo $apiKey; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| <?php | ||
|
|
||
| $client = new \EasyPost\EasyPostClient('EASYPOST_API_KEY'); | ||
|
|
||
| $client->apiKeys->delete('ak_...'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| <?php | ||
|
|
||
| $client = new \EasyPost\EasyPostClient('EASYPOST_API_KEY'); | ||
|
|
||
| $apiKey = $client->apiKeys->disable('ak_...'); | ||
|
|
||
| echo $apiKey; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| <?php | ||
|
|
||
| $client = new \EasyPost\EasyPostClient('EASYPOST_API_KEY'); | ||
|
|
||
| $apiKey = $client->apiKeys->enable('ak_...'); | ||
|
|
||
| echo $apiKey; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import easypost | ||
|
|
||
| client = easypost.EasyPostClient("EASYPOST_API_KEY") | ||
|
|
||
| api_key = client.api_keys.create(mode="test") | ||
|
|
||
| print(api_key) | ||
|
Justintime50 marked this conversation as resolved.
Dismissed
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import easypost | ||
|
|
||
| client = easypost.EasyPostClient("EASYPOST_API_KEY") | ||
|
|
||
| client.api_keys.delete("ak_...") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import easypost | ||
|
|
||
| client = easypost.EasyPostClient("EASYPOST_API_KEY") | ||
|
|
||
| api_key = client.api_keys.disable("ak_...") | ||
|
|
||
| print(api_key) | ||
|
Justintime50 marked this conversation as resolved.
Dismissed
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import easypost | ||
|
|
||
| client = easypost.EasyPostClient("EASYPOST_API_KEY") | ||
|
|
||
| api_key = client.api_keys.enable("ak_...") | ||
|
|
||
| print(api_key) | ||
|
Justintime50 marked this conversation as resolved.
Dismissed
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| require 'easypost' | ||
|
|
||
| client = EasyPost::Client.new(api_key: 'EASYPOST_API_KEY') | ||
|
|
||
| api_key = client.api_key.create('test') | ||
|
|
||
| puts api_key |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| require 'easypost' | ||
|
|
||
| client = EasyPost::Client.new(api_key: 'EASYPOST_API_KEY') | ||
|
|
||
| client.api_key.delete('ak_...') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| require 'easypost' | ||
|
|
||
| client = EasyPost::Client.new(api_key: 'EASYPOST_API_KEY') | ||
|
|
||
| api_key = client.api_key.disable('ak_...') | ||
|
|
||
| puts api_key |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| require 'easypost' | ||
|
|
||
| client = EasyPost::Client.new(api_key: 'EASYPOST_API_KEY') | ||
|
|
||
| api_key = client.api_key.enable('ak_...') | ||
|
|
||
| puts api_key |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.