|
| 1 | +package so.trophy.resources.admin.attributes; |
| 2 | + |
| 3 | +/** |
| 4 | + * This file was auto-generated by Fern from our API Definition. |
| 5 | + */ |
| 6 | + |
| 7 | + |
| 8 | +import so.trophy.core.ClientOptions; |
| 9 | +import so.trophy.core.RequestOptions; |
| 10 | +import java.lang.String; |
| 11 | +import java.util.List; |
| 12 | +import java.util.concurrent.CompletableFuture; |
| 13 | +import so.trophy.resources.admin.attributes.requests.AttributesDeleteRequest; |
| 14 | +import so.trophy.resources.admin.attributes.requests.AttributesListRequest; |
| 15 | +import so.trophy.types.AdminAttribute; |
| 16 | +import so.trophy.types.CreateAttributeRequestItem; |
| 17 | +import so.trophy.types.CreateAttributesResponse; |
| 18 | +import so.trophy.types.DeleteAttributesResponse; |
| 19 | +import so.trophy.types.UpdateAttributeRequestItem; |
| 20 | +import so.trophy.types.UpdateAttributesResponse; |
| 21 | + |
| 22 | +public class AsyncAttributesClient { |
| 23 | + protected final ClientOptions clientOptions; |
| 24 | + |
| 25 | + private final AsyncRawAttributesClient rawClient; |
| 26 | + |
| 27 | + public AsyncAttributesClient(ClientOptions clientOptions) { |
| 28 | + this.clientOptions = clientOptions; |
| 29 | + this.rawClient = new AsyncRawAttributesClient(clientOptions); |
| 30 | + } |
| 31 | + |
| 32 | + /** |
| 33 | + * Get responses with HTTP metadata like headers |
| 34 | + */ |
| 35 | + public AsyncRawAttributesClient withRawResponse() { |
| 36 | + return this.rawClient; |
| 37 | + } |
| 38 | + |
| 39 | + /** |
| 40 | + * List attributes. |
| 41 | + */ |
| 42 | + public CompletableFuture<List<AdminAttribute>> list() { |
| 43 | + return this.rawClient.list().thenApply(response -> response.body()); |
| 44 | + } |
| 45 | + |
| 46 | + /** |
| 47 | + * List attributes. |
| 48 | + */ |
| 49 | + public CompletableFuture<List<AdminAttribute>> list(AttributesListRequest request) { |
| 50 | + return this.rawClient.list(request).thenApply(response -> response.body()); |
| 51 | + } |
| 52 | + |
| 53 | + /** |
| 54 | + * List attributes. |
| 55 | + */ |
| 56 | + public CompletableFuture<List<AdminAttribute>> list(AttributesListRequest request, |
| 57 | + RequestOptions requestOptions) { |
| 58 | + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); |
| 59 | + } |
| 60 | + |
| 61 | + /** |
| 62 | + * Create attributes in bulk. |
| 63 | + */ |
| 64 | + public CompletableFuture<CreateAttributesResponse> create( |
| 65 | + List<CreateAttributeRequestItem> request) { |
| 66 | + return this.rawClient.create(request).thenApply(response -> response.body()); |
| 67 | + } |
| 68 | + |
| 69 | + /** |
| 70 | + * Create attributes in bulk. |
| 71 | + */ |
| 72 | + public CompletableFuture<CreateAttributesResponse> create( |
| 73 | + List<CreateAttributeRequestItem> request, RequestOptions requestOptions) { |
| 74 | + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); |
| 75 | + } |
| 76 | + |
| 77 | + /** |
| 78 | + * Delete attributes in bulk by ID. |
| 79 | + */ |
| 80 | + public CompletableFuture<DeleteAttributesResponse> delete() { |
| 81 | + return this.rawClient.delete().thenApply(response -> response.body()); |
| 82 | + } |
| 83 | + |
| 84 | + /** |
| 85 | + * Delete attributes in bulk by ID. |
| 86 | + */ |
| 87 | + public CompletableFuture<DeleteAttributesResponse> delete(AttributesDeleteRequest request) { |
| 88 | + return this.rawClient.delete(request).thenApply(response -> response.body()); |
| 89 | + } |
| 90 | + |
| 91 | + /** |
| 92 | + * Delete attributes in bulk by ID. |
| 93 | + */ |
| 94 | + public CompletableFuture<DeleteAttributesResponse> delete(AttributesDeleteRequest request, |
| 95 | + RequestOptions requestOptions) { |
| 96 | + return this.rawClient.delete(request, requestOptions).thenApply(response -> response.body()); |
| 97 | + } |
| 98 | + |
| 99 | + /** |
| 100 | + * Update attributes in bulk by ID. |
| 101 | + */ |
| 102 | + public CompletableFuture<UpdateAttributesResponse> update( |
| 103 | + List<UpdateAttributeRequestItem> request) { |
| 104 | + return this.rawClient.update(request).thenApply(response -> response.body()); |
| 105 | + } |
| 106 | + |
| 107 | + /** |
| 108 | + * Update attributes in bulk by ID. |
| 109 | + */ |
| 110 | + public CompletableFuture<UpdateAttributesResponse> update( |
| 111 | + List<UpdateAttributeRequestItem> request, RequestOptions requestOptions) { |
| 112 | + return this.rawClient.update(request, requestOptions).thenApply(response -> response.body()); |
| 113 | + } |
| 114 | + |
| 115 | + /** |
| 116 | + * Get an attribute by ID. |
| 117 | + */ |
| 118 | + public CompletableFuture<AdminAttribute> get(String id) { |
| 119 | + return this.rawClient.get(id).thenApply(response -> response.body()); |
| 120 | + } |
| 121 | + |
| 122 | + /** |
| 123 | + * Get an attribute by ID. |
| 124 | + */ |
| 125 | + public CompletableFuture<AdminAttribute> get(String id, RequestOptions requestOptions) { |
| 126 | + return this.rawClient.get(id, requestOptions).thenApply(response -> response.body()); |
| 127 | + } |
| 128 | +} |
0 commit comments