bunnyshell.com/sdk@v0.16.0/docs/TemplateAPI.md (about) 1 # \TemplateAPI 2 3 All URIs are relative to *https://api.environments.bunnyshell.com* 4 5 Method | HTTP request | Description 6 ------------- | ------------- | ------------- 7 [**TemplateDefinition**](TemplateAPI.md#TemplateDefinition) | **Get** /v1/templates/{id}/definition | View the environment definition. 8 [**TemplateList**](TemplateAPI.md#TemplateList) | **Get** /v1/templates | List templates matching any selected filters. 9 [**TemplateValidate**](TemplateAPI.md#TemplateValidate) | **Post** /v1/templates/validate | Validates a given template from an external source. 10 [**TemplateView**](TemplateAPI.md#TemplateView) | **Get** /v1/templates/{id} | View a specific template. 11 12 13 14 ## TemplateDefinition 15 16 > map[string]interface{} TemplateDefinition(ctx, id).Execute() 17 18 View the environment definition. 19 20 21 22 ### Example 23 24 ```go 25 package main 26 27 import ( 28 "context" 29 "fmt" 30 "os" 31 openapiclient "bunnyshell.com/sdk" 32 ) 33 34 func main() { 35 id := "id_example" // string | Resource identifier 36 37 configuration := openapiclient.NewConfiguration() 38 apiClient := openapiclient.NewAPIClient(configuration) 39 resp, r, err := apiClient.TemplateAPI.TemplateDefinition(context.Background(), id).Execute() 40 if err != nil { 41 fmt.Fprintf(os.Stderr, "Error when calling `TemplateAPI.TemplateDefinition``: %v\n", err) 42 fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) 43 } 44 // response from `TemplateDefinition`: map[string]interface{} 45 fmt.Fprintf(os.Stdout, "Response from `TemplateAPI.TemplateDefinition`: %v\n", resp) 46 } 47 ``` 48 49 ### Path Parameters 50 51 52 Name | Type | Description | Notes 53 ------------- | ------------- | ------------- | ------------- 54 **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. 55 **id** | **string** | Resource identifier | 56 57 ### Other Parameters 58 59 Other parameters are passed through a pointer to a apiTemplateDefinitionRequest struct via the builder pattern 60 61 62 Name | Type | Description | Notes 63 ------------- | ------------- | ------------- | ------------- 64 65 66 ### Return type 67 68 **map[string]interface{}** 69 70 ### Authorization 71 72 [JWT](../README.md#JWT), [ApiKeyAuth](../README.md#ApiKeyAuth) 73 74 ### HTTP request headers 75 76 - **Content-Type**: Not defined 77 - **Accept**: application/x+yaml, application/problem+json 78 79 [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) 80 [[Back to Model list]](../README.md#documentation-for-models) 81 [[Back to README]](../README.md) 82 83 84 ## TemplateList 85 86 > PaginatedTemplateCollection TemplateList(ctx).Page(page).Organization(organization).TemplatesRepository(templatesRepository).Source(source).Search(search).Execute() 87 88 List templates matching any selected filters. 89 90 91 92 ### Example 93 94 ```go 95 package main 96 97 import ( 98 "context" 99 "fmt" 100 "os" 101 openapiclient "bunnyshell.com/sdk" 102 ) 103 104 func main() { 105 page := int32(56) // int32 | The collection page number (optional) (default to 1) 106 organization := "organization_example" // string | Filter by organization (optional) 107 templatesRepository := "templatesRepository_example" // string | Filter by templatesRepository (optional) 108 source := "all" // string | Filter used to fetch templates by source. * `public` - contains Bunnyshell curated templates * `private` - contains your organizations templates * `all` - contains templates for every source (optional) 109 search := "search_example" // string | Filter by search (optional) 110 111 configuration := openapiclient.NewConfiguration() 112 apiClient := openapiclient.NewAPIClient(configuration) 113 resp, r, err := apiClient.TemplateAPI.TemplateList(context.Background()).Page(page).Organization(organization).TemplatesRepository(templatesRepository).Source(source).Search(search).Execute() 114 if err != nil { 115 fmt.Fprintf(os.Stderr, "Error when calling `TemplateAPI.TemplateList``: %v\n", err) 116 fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) 117 } 118 // response from `TemplateList`: PaginatedTemplateCollection 119 fmt.Fprintf(os.Stdout, "Response from `TemplateAPI.TemplateList`: %v\n", resp) 120 } 121 ``` 122 123 ### Path Parameters 124 125 126 127 ### Other Parameters 128 129 Other parameters are passed through a pointer to a apiTemplateListRequest struct via the builder pattern 130 131 132 Name | Type | Description | Notes 133 ------------- | ------------- | ------------- | ------------- 134 **page** | **int32** | The collection page number | [default to 1] 135 **organization** | **string** | Filter by organization | 136 **templatesRepository** | **string** | Filter by templatesRepository | 137 **source** | **string** | Filter used to fetch templates by source. * `public` - contains Bunnyshell curated templates * `private` - contains your organizations templates * `all` - contains templates for every source | 138 **search** | **string** | Filter by search | 139 140 ### Return type 141 142 [**PaginatedTemplateCollection**](PaginatedTemplateCollection.md) 143 144 ### Authorization 145 146 [JWT](../README.md#JWT), [ApiKeyAuth](../README.md#ApiKeyAuth) 147 148 ### HTTP request headers 149 150 - **Content-Type**: Not defined 151 - **Accept**: application/hal+json, application/problem+json 152 153 [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) 154 [[Back to Model list]](../README.md#documentation-for-models) 155 [[Back to README]](../README.md) 156 157 158 ## TemplateValidate 159 160 > TemplateCollection TemplateValidate(ctx).TemplateValidateAction(templateValidateAction).Execute() 161 162 Validates a given template from an external source. 163 164 165 166 ### Example 167 168 ```go 169 package main 170 171 import ( 172 "context" 173 "fmt" 174 "os" 175 openapiclient "bunnyshell.com/sdk" 176 ) 177 178 func main() { 179 templateValidateAction := *openapiclient.NewTemplateValidateAction() // TemplateValidateAction | The new template resource 180 181 configuration := openapiclient.NewConfiguration() 182 apiClient := openapiclient.NewAPIClient(configuration) 183 resp, r, err := apiClient.TemplateAPI.TemplateValidate(context.Background()).TemplateValidateAction(templateValidateAction).Execute() 184 if err != nil { 185 fmt.Fprintf(os.Stderr, "Error when calling `TemplateAPI.TemplateValidate``: %v\n", err) 186 fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) 187 } 188 // response from `TemplateValidate`: TemplateCollection 189 fmt.Fprintf(os.Stdout, "Response from `TemplateAPI.TemplateValidate`: %v\n", resp) 190 } 191 ``` 192 193 ### Path Parameters 194 195 196 197 ### Other Parameters 198 199 Other parameters are passed through a pointer to a apiTemplateValidateRequest struct via the builder pattern 200 201 202 Name | Type | Description | Notes 203 ------------- | ------------- | ------------- | ------------- 204 **templateValidateAction** | [**TemplateValidateAction**](TemplateValidateAction.md) | The new template resource | 205 206 ### Return type 207 208 [**TemplateCollection**](TemplateCollection.md) 209 210 ### Authorization 211 212 [JWT](../README.md#JWT), [ApiKeyAuth](../README.md#ApiKeyAuth) 213 214 ### HTTP request headers 215 216 - **Content-Type**: application/json 217 - **Accept**: application/hal+json, application/problem+json 218 219 [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) 220 [[Back to Model list]](../README.md#documentation-for-models) 221 [[Back to README]](../README.md) 222 223 224 ## TemplateView 225 226 > TemplateItem TemplateView(ctx, id).Execute() 227 228 View a specific template. 229 230 231 232 ### Example 233 234 ```go 235 package main 236 237 import ( 238 "context" 239 "fmt" 240 "os" 241 openapiclient "bunnyshell.com/sdk" 242 ) 243 244 func main() { 245 id := "id_example" // string | Resource identifier 246 247 configuration := openapiclient.NewConfiguration() 248 apiClient := openapiclient.NewAPIClient(configuration) 249 resp, r, err := apiClient.TemplateAPI.TemplateView(context.Background(), id).Execute() 250 if err != nil { 251 fmt.Fprintf(os.Stderr, "Error when calling `TemplateAPI.TemplateView``: %v\n", err) 252 fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) 253 } 254 // response from `TemplateView`: TemplateItem 255 fmt.Fprintf(os.Stdout, "Response from `TemplateAPI.TemplateView`: %v\n", resp) 256 } 257 ``` 258 259 ### Path Parameters 260 261 262 Name | Type | Description | Notes 263 ------------- | ------------- | ------------- | ------------- 264 **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. 265 **id** | **string** | Resource identifier | 266 267 ### Other Parameters 268 269 Other parameters are passed through a pointer to a apiTemplateViewRequest struct via the builder pattern 270 271 272 Name | Type | Description | Notes 273 ------------- | ------------- | ------------- | ------------- 274 275 276 ### Return type 277 278 [**TemplateItem**](TemplateItem.md) 279 280 ### Authorization 281 282 [JWT](../README.md#JWT), [ApiKeyAuth](../README.md#ApiKeyAuth) 283 284 ### HTTP request headers 285 286 - **Content-Type**: Not defined 287 - **Accept**: application/hal+json, application/problem+json 288 289 [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) 290 [[Back to Model list]](../README.md#documentation-for-models) 291 [[Back to README]](../README.md) 292