Skip to content

Commit 183a2de

Browse files
committed
get recipe card
1 parent aed8d5c commit 183a2de

File tree

255 files changed

+3540
-168
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

255 files changed

+3540
-168
lines changed

android/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ All URIs are relative to *https://api.spoonacular.com*
8787
Class | Method | HTTP request | Description
8888
------------ | ------------- | ------------- | -------------
8989
*DefaultApi* | [**analyzeRecipe**](docs/DefaultApi.md#analyzeRecipe) | **POST** /recipes/analyze | Analyze Recipe
90+
*DefaultApi* | [**createRecipeCardGet**](docs/DefaultApi.md#createRecipeCardGet) | **GET** /recipes/{id}/card | Create Recipe Card
9091
*DefaultApi* | [**searchRestaurants**](docs/DefaultApi.md#searchRestaurants) | **GET** /food/restaurants/search | Search Restaurants
9192
*IngredientsApi* | [**autocompleteIngredientSearch**](docs/IngredientsApi.md#autocompleteIngredientSearch) | **GET** /food/ingredients/autocomplete | Autocomplete Ingredient Search
9293
*IngredientsApi* | [**computeIngredientAmount**](docs/IngredientsApi.md#computeIngredientAmount) | **GET** /food/ingredients/{id}/amount | Compute Ingredient Amount

android/docs/DefaultApi.md

+55
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ All URIs are relative to *https://api.spoonacular.com*
55
Method | HTTP request | Description
66
------------- | ------------- | -------------
77
[**analyzeRecipe**](DefaultApi.md#analyzeRecipe) | **POST** /recipes/analyze | Analyze Recipe
8+
[**createRecipeCardGet**](DefaultApi.md#createRecipeCardGet) | **GET** /recipes/{id}/card | Create Recipe Card
89
[**searchRestaurants**](DefaultApi.md#searchRestaurants) | **GET** /food/restaurants/search | Search Restaurants
910

1011

@@ -61,6 +62,60 @@ Name | Type | Description | Notes
6162
- **Accept**: application/json
6263

6364

65+
## createRecipeCardGet
66+
67+
> Object createRecipeCardGet(id, mask, backgroundImage, backgroundColor, fontColor)
68+
69+
Create Recipe Card
70+
71+
Generate a recipe card for a recipe.
72+
73+
### Example
74+
75+
```java
76+
// Import classes:
77+
//import com.spoonacular.DefaultApi;
78+
79+
DefaultApi apiInstance = new DefaultApi();
80+
BigDecimal id = 4632; // BigDecimal | The recipe id.
81+
String mask = ellipseMask; // String | The mask to put over the recipe image (\"ellipseMask\", \"diamondMask\", \"starMask\", \"heartMask\", \"potMask\", \"fishMask\").
82+
String backgroundImage = background1; // String | The background image (\"none\",\"background1\", or \"background2\").
83+
String backgroundColor = ffffff; // String | The background color for the recipe card as a hex-string.
84+
String fontColor = 333333; // String | The font color for the recipe card as a hex-string.
85+
try {
86+
Object result = apiInstance.createRecipeCardGet(id, mask, backgroundImage, backgroundColor, fontColor);
87+
System.out.println(result);
88+
} catch (ApiException e) {
89+
System.err.println("Exception when calling DefaultApi#createRecipeCardGet");
90+
e.printStackTrace();
91+
}
92+
```
93+
94+
### Parameters
95+
96+
97+
Name | Type | Description | Notes
98+
------------- | ------------- | ------------- | -------------
99+
**id** | **BigDecimal**| The recipe id. | [default to null]
100+
**mask** | **String**| The mask to put over the recipe image (\"ellipseMask\", \"diamondMask\", \"starMask\", \"heartMask\", \"potMask\", \"fishMask\"). | [optional] [default to null]
101+
**backgroundImage** | **String**| The background image (\"none\",\"background1\", or \"background2\"). | [optional] [default to null]
102+
**backgroundColor** | **String**| The background color for the recipe card as a hex-string. | [optional] [default to null]
103+
**fontColor** | **String**| The font color for the recipe card as a hex-string. | [optional] [default to null]
104+
105+
### Return type
106+
107+
**Object**
108+
109+
### Authorization
110+
111+
[apiKeyScheme](../README.md#apiKeyScheme)
112+
113+
### HTTP request headers
114+
115+
- **Content-Type**: Not defined
116+
- **Accept**: application/json
117+
118+
64119
## searchRestaurants
65120

66121
> SearchRestaurants200Response searchRestaurants(query, lat, lng, distance, budget, cuisine, minRating, isOpen, sort, page)

android/src/main/java/com/spoonacular/DefaultApi.java

+139
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,145 @@ public void onErrorResponse(VolleyError error) {
197197
}
198198
}
199199
/**
200+
* Create Recipe Card
201+
* Generate a recipe card for a recipe.
202+
* @param id The recipe id.
203+
* @param mask The mask to put over the recipe image (\"ellipseMask\", \"diamondMask\", \"starMask\", \"heartMask\", \"potMask\", \"fishMask\").
204+
* @param backgroundImage The background image (\"none\",\"background1\", or \"background2\").
205+
* @param backgroundColor The background color for the recipe card as a hex-string.
206+
* @param fontColor The font color for the recipe card as a hex-string.
207+
* @return Object
208+
*/
209+
public Object createRecipeCardGet (BigDecimal id, String mask, String backgroundImage, String backgroundColor, String fontColor) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
210+
Object postBody = null;
211+
// verify the required parameter 'id' is set
212+
if (id == null) {
213+
VolleyError error = new VolleyError("Missing the required parameter 'id' when calling createRecipeCardGet",
214+
new ApiException(400, "Missing the required parameter 'id' when calling createRecipeCardGet"));
215+
}
216+
217+
// create path and map variables
218+
String path = "/recipes/{id}/card".replaceAll("\\{" + "id" + "\\}", apiInvoker.escapeString(id.toString()));
219+
220+
// query params
221+
List<Pair> queryParams = new ArrayList<Pair>();
222+
// header params
223+
Map<String, String> headerParams = new HashMap<String, String>();
224+
// form params
225+
Map<String, String> formParams = new HashMap<String, String>();
226+
queryParams.addAll(ApiInvoker.parameterToPairs("", "mask", mask));
227+
queryParams.addAll(ApiInvoker.parameterToPairs("", "backgroundImage", backgroundImage));
228+
queryParams.addAll(ApiInvoker.parameterToPairs("", "backgroundColor", backgroundColor));
229+
queryParams.addAll(ApiInvoker.parameterToPairs("", "fontColor", fontColor));
230+
String[] contentTypes = {
231+
};
232+
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
233+
234+
if (contentType.startsWith("multipart/form-data")) {
235+
// file uploading
236+
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
237+
HttpEntity httpEntity = localVarBuilder.build();
238+
postBody = httpEntity;
239+
} else {
240+
// normal form params
241+
}
242+
243+
String[] authNames = new String[] { "apiKeyScheme" };
244+
245+
try {
246+
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
247+
if (localVarResponse != null) {
248+
return (Object) ApiInvoker.deserialize(localVarResponse, "", Object.class);
249+
} else {
250+
return null;
251+
}
252+
} catch (ApiException ex) {
253+
throw ex;
254+
} catch (InterruptedException ex) {
255+
throw ex;
256+
} catch (ExecutionException ex) {
257+
if (ex.getCause() instanceof VolleyError) {
258+
VolleyError volleyError = (VolleyError)ex.getCause();
259+
if (volleyError.networkResponse != null) {
260+
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
261+
}
262+
}
263+
throw ex;
264+
} catch (TimeoutException ex) {
265+
throw ex;
266+
}
267+
}
268+
269+
/**
270+
* Create Recipe Card
271+
* Generate a recipe card for a recipe.
272+
* @param id The recipe id. * @param mask The mask to put over the recipe image (\&quot;ellipseMask\&quot;, \&quot;diamondMask\&quot;, \&quot;starMask\&quot;, \&quot;heartMask\&quot;, \&quot;potMask\&quot;, \&quot;fishMask\&quot;). * @param backgroundImage The background image (\&quot;none\&quot;,\&quot;background1\&quot;, or \&quot;background2\&quot;). * @param backgroundColor The background color for the recipe card as a hex-string. * @param fontColor The font color for the recipe card as a hex-string.
273+
*/
274+
public void createRecipeCardGet (BigDecimal id, String mask, String backgroundImage, String backgroundColor, String fontColor, final Response.Listener<Object> responseListener, final Response.ErrorListener errorListener) {
275+
Object postBody = null;
276+
277+
// verify the required parameter 'id' is set
278+
if (id == null) {
279+
VolleyError error = new VolleyError("Missing the required parameter 'id' when calling createRecipeCardGet",
280+
new ApiException(400, "Missing the required parameter 'id' when calling createRecipeCardGet"));
281+
}
282+
283+
// create path and map variables
284+
String path = "/recipes/{id}/card".replaceAll("\\{format\\}","json").replaceAll("\\{" + "id" + "\\}", apiInvoker.escapeString(id.toString()));
285+
286+
// query params
287+
List<Pair> queryParams = new ArrayList<Pair>();
288+
// header params
289+
Map<String, String> headerParams = new HashMap<String, String>();
290+
// form params
291+
Map<String, String> formParams = new HashMap<String, String>();
292+
293+
queryParams.addAll(ApiInvoker.parameterToPairs("", "mask", mask));
294+
queryParams.addAll(ApiInvoker.parameterToPairs("", "backgroundImage", backgroundImage));
295+
queryParams.addAll(ApiInvoker.parameterToPairs("", "backgroundColor", backgroundColor));
296+
queryParams.addAll(ApiInvoker.parameterToPairs("", "fontColor", fontColor));
297+
298+
299+
String[] contentTypes = {
300+
301+
};
302+
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
303+
304+
if (contentType.startsWith("multipart/form-data")) {
305+
// file uploading
306+
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
307+
308+
309+
HttpEntity httpEntity = localVarBuilder.build();
310+
postBody = httpEntity;
311+
} else {
312+
// normal form params
313+
}
314+
315+
String[] authNames = new String[] { "apiKeyScheme" };
316+
317+
try {
318+
apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames,
319+
new Response.Listener<String>() {
320+
@Override
321+
public void onResponse(String localVarResponse) {
322+
try {
323+
responseListener.onResponse((Object) ApiInvoker.deserialize(localVarResponse, "", Object.class));
324+
} catch (ApiException exception) {
325+
errorListener.onErrorResponse(new VolleyError(exception));
326+
}
327+
}
328+
}, new Response.ErrorListener() {
329+
@Override
330+
public void onErrorResponse(VolleyError error) {
331+
errorListener.onErrorResponse(error);
332+
}
333+
});
334+
} catch (ApiException ex) {
335+
errorListener.onErrorResponse(new VolleyError(ex));
336+
}
337+
}
338+
/**
200339
* Search Restaurants
201340
* Search through thousands of restaurants (in North America) by location, cuisine, budget, and more.
202341
* @param query The search query.

angular/com/spoonacular/default.service.ts

+88
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,94 @@ export class DefaultService {
185185
);
186186
}
187187

188+
/**
189+
* Create Recipe Card
190+
* Generate a recipe card for a recipe.
191+
* @param id The recipe id.
192+
* @param mask The mask to put over the recipe image (\&quot;ellipseMask\&quot;, \&quot;diamondMask\&quot;, \&quot;starMask\&quot;, \&quot;heartMask\&quot;, \&quot;potMask\&quot;, \&quot;fishMask\&quot;).
193+
* @param backgroundImage The background image (\&quot;none\&quot;,\&quot;background1\&quot;, or \&quot;background2\&quot;).
194+
* @param backgroundColor The background color for the recipe card as a hex-string.
195+
* @param fontColor The font color for the recipe card as a hex-string.
196+
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
197+
* @param reportProgress flag to report request and response progress.
198+
*/
199+
public createRecipeCardGet(id: number, mask?: string, backgroundImage?: string, backgroundColor?: string, fontColor?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<object>;
200+
public createRecipeCardGet(id: number, mask?: string, backgroundImage?: string, backgroundColor?: string, fontColor?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<object>>;
201+
public createRecipeCardGet(id: number, mask?: string, backgroundImage?: string, backgroundColor?: string, fontColor?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<object>>;
202+
public createRecipeCardGet(id: number, mask?: string, backgroundImage?: string, backgroundColor?: string, fontColor?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
203+
if (id === null || id === undefined) {
204+
throw new Error('Required parameter id was null or undefined when calling createRecipeCardGet.');
205+
}
206+
207+
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
208+
if (mask !== undefined && mask !== null) {
209+
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
210+
<any>mask, 'mask');
211+
}
212+
if (backgroundImage !== undefined && backgroundImage !== null) {
213+
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
214+
<any>backgroundImage, 'backgroundImage');
215+
}
216+
if (backgroundColor !== undefined && backgroundColor !== null) {
217+
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
218+
<any>backgroundColor, 'backgroundColor');
219+
}
220+
if (fontColor !== undefined && fontColor !== null) {
221+
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
222+
<any>fontColor, 'fontColor');
223+
}
224+
225+
let localVarHeaders = this.defaultHeaders;
226+
227+
let localVarCredential: string | undefined;
228+
// authentication (apiKeyScheme) required
229+
localVarCredential = this.configuration.lookupCredential('apiKeyScheme');
230+
if (localVarCredential) {
231+
localVarHeaders = localVarHeaders.set('x-api-key', localVarCredential);
232+
}
233+
234+
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
235+
if (localVarHttpHeaderAcceptSelected === undefined) {
236+
// to determine the Accept header
237+
const httpHeaderAccepts: string[] = [
238+
'application/json'
239+
];
240+
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
241+
}
242+
if (localVarHttpHeaderAcceptSelected !== undefined) {
243+
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
244+
}
245+
246+
let localVarHttpContext: HttpContext | undefined = options && options.context;
247+
if (localVarHttpContext === undefined) {
248+
localVarHttpContext = new HttpContext();
249+
}
250+
251+
252+
let responseType_: 'text' | 'json' | 'blob' = 'json';
253+
if (localVarHttpHeaderAcceptSelected) {
254+
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
255+
responseType_ = 'text';
256+
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
257+
responseType_ = 'json';
258+
} else {
259+
responseType_ = 'blob';
260+
}
261+
}
262+
263+
return this.httpClient.get<object>(`${this.configuration.basePath}/recipes/${encodeURIComponent(String(id))}/card`,
264+
{
265+
context: localVarHttpContext,
266+
params: localVarQueryParameters,
267+
responseType: <any>responseType_,
268+
withCredentials: this.configuration.withCredentials,
269+
headers: localVarHeaders,
270+
observe: observe,
271+
reportProgress: reportProgress
272+
}
273+
);
274+
}
275+
188276
/**
189277
* Search Restaurants
190278
* Search through thousands of restaurants (in North America) by location, cuisine, budget, and more.

clojure/src/spoonacular_api/api/default.clj

+26
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,32 @@
193193
res))))
194194

195195

196+
(defn-spec create-recipe-card-get-with-http-info any?
197+
"Create Recipe Card
198+
Generate a recipe card for a recipe."
199+
([id float?, ] (create-recipe-card-get-with-http-info id nil))
200+
([id float?, {:keys [mask backgroundImage backgroundColor fontColor]} (s/map-of keyword? any?)]
201+
(check-required-params id)
202+
(call-api "/recipes/{id}/card" :get
203+
{:path-params {"id" id }
204+
:header-params {}
205+
:query-params {"mask" mask "backgroundImage" backgroundImage "backgroundColor" backgroundColor "fontColor" fontColor }
206+
:form-params {}
207+
:content-types []
208+
:accepts ["application/json"]
209+
:auth-names ["apiKeyScheme"]})))
210+
211+
(defn-spec create-recipe-card-get any?
212+
"Create Recipe Card
213+
Generate a recipe card for a recipe."
214+
([id float?, ] (create-recipe-card-get id nil))
215+
([id float?, optional-params any?]
216+
(let [res (:data (create-recipe-card-get-with-http-info id optional-params))]
217+
(if (:decode-models *api-context*)
218+
(st/decode any? res st/string-transformer)
219+
res))))
220+
221+
196222
(defn-spec search-restaurants-with-http-info any?
197223
"Search Restaurants
198224
Search through thousands of restaurants (in North America) by location, cuisine, budget, and more."

csharp/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ All URIs are relative to *https://api.spoonacular.com*
8686
Class | Method | HTTP request | Description
8787
------------ | ------------- | ------------- | -------------
8888
*DefaultApi* | [**AnalyzeRecipe**](docs/DefaultApi.md#analyzerecipe) | **POST** /recipes/analyze | Analyze Recipe
89+
*DefaultApi* | [**CreateRecipeCardGet**](docs/DefaultApi.md#createrecipecardget) | **GET** /recipes/{id}/card | Create Recipe Card
8990
*DefaultApi* | [**SearchRestaurants**](docs/DefaultApi.md#searchrestaurants) | **GET** /food/restaurants/search | Search Restaurants
9091
*IngredientsApi* | [**AutocompleteIngredientSearch**](docs/IngredientsApi.md#autocompleteingredientsearch) | **GET** /food/ingredients/autocomplete | Autocomplete Ingredient Search
9192
*IngredientsApi* | [**ComputeIngredientAmount**](docs/IngredientsApi.md#computeingredientamount) | **GET** /food/ingredients/{id}/amount | Compute Ingredient Amount

0 commit comments

Comments
 (0)