Skip to content

Commit

Permalink
feat: Eng 4024 java sdk re (#29)
Browse files Browse the repository at this point in the history
* parent 2838d93
author Jordan <Jordantay9014@outlook.com> 1672347669 -0600
committer Jordan <Jordantay9014@outlook.com> 1673381335 -0600

added java sdk and api ref

* Update types.mdx

* Update java.mdx

* Update applications.mdx

* Update java.mdx

* Update logs.mdx

* Update permissions.mdx

* added java tag in config for code snippets

* Removing explict sdk version and fixing code sample language tag

* Changing java version from 8.0+ to 8+ to match how people normally refer to it

Co-authored-by: Drew Hudec <drew@basistheory.com>
  • Loading branch information
JustJordanT and dhudec authored Jan 23, 2023
1 parent faaa2b2 commit 22e0d14
Show file tree
Hide file tree
Showing 19 changed files with 1,479 additions and 7 deletions.
170 changes: 168 additions & 2 deletions docs/api/applications/applications.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,35 @@ var application = await client.CreateAsync(new Application {
Type = "private",
Permissions = new List<string> { "token:create", "token:read" }
});
```

</TabItem>
<TabItem value="java" label="Java">

```java showLineNumbers
import com.basistheory.ApiClient;
import com.basistheory.ApiException;
import com.basistheory.Configuration;
import com.basistheory.auth.*;
import com.basistheory.models.*;
import com.basistheory.ApplicationsApi;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.basistheory.com");

ApiKeyAuth ApiKey = (ApiKeyAuth) defaultClient.getAuthentication("ApiKey");
ApiKey.setApiKey("key_N88mVGsp3sCXkykyN2EFED");

ApplicationsApi apiInstance = new ApplicationsApi(defaultClient);
CreateApplicationRequest createApplicationRequest = new CreateApplicationRequest();
var application = apiInstance.create(createApplicationRequest
.name("ApplicationName123123")
.type("private")
.permissions(Arrays.asList("token:create", "token:read")));
}
}
```

</TabItem>
Expand Down Expand Up @@ -120,7 +149,6 @@ func main() {
application, httpResponse, err := apiClient.ApplicationsApi.Create(contextWithAPIKey).CreateApplicationRequest(createApplicationRequest).Execute()
}
```

</TabItem>
</Tabs>

Expand Down Expand Up @@ -186,7 +214,6 @@ const bt = await new BasisTheory().init("key_N88mVGsp3sCXkykyN2EFED");

const applications = await bt.applications.list();
```

</TabItem>
<TabItem value="csharp" label="C#">

Expand All @@ -198,6 +225,33 @@ var client = new ApplicationClient("key_N88mVGsp3sCXkykyN2EFED");
var applications = await client.GetAsync();
```

</TabItem>
<TabItem value="java" label="Java">

```java
import com.basistheory.*;
import com.basistheory.auth.*;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;

public class Example {
public static void main(String[] args) throws Exception {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.basistheory.com");

ApiKeyAuth ApiKey = (ApiKeyAuth) defaultClient.getAuthentication("ApiKey");
ApiKey.setApiKey("key_N88mVGsp3sCXkykyN2EFED");

ApplicationsApi apiInstance = new ApplicationsApi(defaultClient);
List<UUID> id = Arrays.asList();
List<String> type = Arrays.asList();
Integer page = 1;
Integer size = 38;
ApplicationPaginatedList result = apiInstance.get(id, type, page, size);
}
```

</TabItem>
<TabItem value="python" label="Python">

Expand Down Expand Up @@ -315,6 +369,27 @@ using BasisTheory.net.Applications;
var client = new ApplicationClient("key_N88mVGsp3sCXkykyN2EFED");
var application = await client.GetByIdAsync("fe1f9ba4-474e-44b9-b949-110cdba9d662");
```
</TabItem>
<TabItem value="java" label="Java">
```java showLineNumbers
import com.basistheory.*;
import com.basistheory.auth.*;
public class Example {
public static void main(String[] args) throws Exception {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.basistheory.com");
ApiKeyAuth ApiKey = (ApiKeyAuth) defaultClient.getAuthentication("ApiKey");
ApiKey.setApiKey("key_N88mVGsp3sCXkykyN2EFED");
ApplicationsApi apiInstance = new ApplicationsApi(defaultClient);
Application result = apiInstance.getById("9b806250-d507-46e7-9dc0-de0f89a91a92");
}
}
```
</TabItem>
Expand Down Expand Up @@ -422,6 +497,27 @@ using BasisTheory.net.Applications;
var client = new ApplicationClient("key_N88mVGsp3sCXkykyN2EFED");
var application = await client.GetByKeyAsync();
```
</TabItem>
<TabItem value="java" label="Java">
```java showLineNumbers
import com.basistheory.*;
import com.basistheory.auth.*;
public class Example {
public static void main(String[] args) throws Exception {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.basistheory.com");
ApiKeyAuth ApiKey = (ApiKeyAuth) defaultClient.getAuthentication("ApiKey");
ApiKey.setApiKey("key_N88mVGsp3sCXkykyN2EFED");
ApplicationsApi apiInstance = new ApplicationsApi(defaultClient);
Application result = apiInstance.getByKey();
}
}
```
</TabItem>
Expand Down Expand Up @@ -543,6 +639,32 @@ var application = await client.UpdateAsync("fb124bba-f90d-45f0-9a59-5edca27b3b4a
Permissions = new List<string> { "application:create", "application:read" }
}
);
```
</TabItem>
<TabItem value="java" label="Java">
```java showLineNumbers
import com.basistheory.*;
import com.basistheory.auth.*;
import java.util.Arrays;
import java.util.UUID;
public class Example {
public static void main(String[] args) throws Exception {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.basistheory.com");
ApiKeyAuth ApiKey = (ApiKeyAuth) defaultClient.getAuthentication("ApiKey");
ApiKey.setApiKey("key_N88mVGsp3sCXkykyN2EFED");
ApplicationsApi apiInstance = new ApplicationsApi(defaultClient);
UpdateApplicationRequest updateApplicationRequest = new UpdateApplicationRequest();
Application application = apiInstance.update("f7c90548-ea08-4757-bb2d-a5cfe3fb4782", updateApplicationRequest
.name("ApplicationName")
.permissions(Arrays.asList("token:create")));
}
}
```
</TabItem>
Expand Down Expand Up @@ -675,6 +797,27 @@ using BasisTheory.net.Applications;
var client = new ApplicationClient("key_N88mVGsp3sCXkykyN2EFED");
var application = await client.RegenerateKeyAsync("fb124bba-f90d-45f0-9a59-5edca27b3b4a");
```
</TabItem>
<TabItem value="java" label="Java">
```java showLineNumbers
import com.basistheory.*;
import com.basistheory.auth.*;
public class Example {
public static void main(String[] args) throws Exception {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.basistheory.com");
ApiKeyAuth ApiKey = (ApiKeyAuth) defaultClient.getAuthentication("ApiKey");
ApiKey.setApiKey("key_N88mVGsp3sCXkykyN2EFED");
ApplicationsApi apiInstance = new ApplicationsApi(defaultClient);
Application result = apiInstance.regenerateKey("f7c90548-ea08-4757-bb2d-a5cfe3fb4782");
}
}
```
</TabItem>
Expand Down Expand Up @@ -784,6 +927,29 @@ using BasisTheory.net.Applications;
var client = new ApplicationClient("key_N88mVGsp3sCXkykyN2EFED");
await client.DeleteAsync("fb124bba-f90d-45f0-9a59-5edca27b3b4a");
```
</TabItem>
<TabItem value="java" label="Java">
```java showLineNumbers
import com.basistheory.*;
import com.basistheory.auth.*;
import java.util.UUID;
public class Example {
public static void main(String[] args) throws Exception {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.basistheory.com");
ApiKeyAuth ApiKey = (ApiKeyAuth) defaultClient.getAuthentication("ApiKey");
ApiKey.setApiKey("key_N88mVGsp3sCXkykyN2EFED");
ApplicationsApi apiInstance = new ApplicationsApi(defaultClient);
apiInstance.delete("f7c90548-ea08-4757-bb2d-a5cfe3fb4782");
}
}
```
</TabItem>
Expand Down
24 changes: 24 additions & 0 deletions docs/api/applications/permissions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,30 @@ using BasisTheory.net.Permissions;
var client = new PermissionClient("key_N88mVGsp3sCXkykyN2EFED");

var permissions = await client.GetAsync();
```

</TabItem>
<TabItem value="java" label="Java">

```java showLineNumbers
import com.basistheory.*;
import com.basistheory.auth.*;
import java.util.List;

public class App {
public static void main(String[] args) throws Exception {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.basistheory.com");

ApiKeyAuth ApiKey = (ApiKeyAuth) defaultClient.getAuthentication("ApiKey");
ApiKey.setApiKey("key_N88mVGsp3sCXkykyN2EFED");

PermissionsApi apiInstance = new PermissionsApi(defaultClient);
String applicationType = null;
Integer version = null;
List<Permission> result = apiInstance.get(applicationType, version);
}
}
```

</TabItem>
Expand Down
32 changes: 31 additions & 1 deletion docs/api/logs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,36 @@ using BasisTheory.net.Logs;
var client = new LogClient("key_N88mVGsp3sCXkykyN2EFED");

var logs = await client.GetAsync();
```

</TabItem>
<TabItem value="java" label="Java">

```java showLineNumbers
import com.basistheory.*;
import com.basistheory.auth.*;
import java.time.OffsetDateTime;
import java.util.UUID;

public class Example {
public static void main(String[] args) throws Exception {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.basistheory.com");

ApiKeyAuth ApiKey = (ApiKeyAuth) defaultClient.getAuthentication("ApiKey");
ApiKey.setApiKey("key_N88mVGsp3sCXkykyN2EFED");

LogsApi apiInstance = new LogsApi(defaultClient);
String entityType = null;
String entityId = null;
OffsetDateTime startDate = OffsetDateTime.now().minusDays(7);
OffsetDateTime endDate = OffsetDateTime.now();
Integer page = 1;
Integer size = 56;
LogPaginatedList result = apiInstance.get(entityType, entityId, startDate, endDate, page, size);
System.out.println(result);
}
}
```

</TabItem>
Expand Down Expand Up @@ -193,4 +223,4 @@ Returns a non-paginated array of [entity types](#entity-type-object).
| Attribute | Type | Description |
| -------------- | -------- | ------------------------------------------------------------------ |
| `display_name` | _string_ | A readable string name for the entity type |
| `value` | _string_ | The system name of the entity. Referenced by a log's `entity_type` |
| `value` | _string_ | The system name of the entity. Referenced by a log's `entity_type` |
Loading

1 comment on commit 22e0d14

@vercel
Copy link

@vercel vercel bot commented on 22e0d14 Jan 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.