fdc

package module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2024 License: CC0-1.0 Imports: 21 Imported by: 0

README

Go API client for swagger

The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on Data Type Documentation. This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the FDC website

Overview

This API client was generated by the swagger-codegen project. By using the swagger-spec from a remote server, you can easily generate an API client.

Installation

Put the package under your project folder and add the following in import:

import "github.com/deep-space-cartel/fooddata-central-client-go"

Documentation for API Endpoints

All URIs are relative to https://api.nal.usda.gov/fdc

Class Method HTTP request Description
FDCApi GetFood Get /v1/food/{fdcId} Fetches details for one food item by FDC ID
FDCApi GetFoods Get /v1/foods Fetches details for multiple food items using input FDC IDs
FDCApi GetFoodsList Get /v1/foods/list Returns a paged list of foods, in the 'abridged' format
FDCApi GetFoodsSearch Get /v1/foods/search Returns a list of foods that matched search (query) keywords
FDCApi GetJsonSpec Get /v1/json-spec Returns this documentation in JSON format
FDCApi GetYamlSpec Get /v1/yaml-spec Returns this documentation in JSON format
FDCApi PostFoods Post /v1/foods Fetches details for multiple food items using input FDC IDs
FDCApi PostFoodsList Post /v1/foods/list Returns a paged list of foods, in the 'abridged' format
FDCApi PostFoodsSearch Post /v1/foods/search Returns a list of foods that matched search (query) keywords

Documentation For Models

Documentation For Authorization

ApiKeyAuth

  • Type: API key

Example

type CustomTransport struct {
	Transport http.RoundTripper
}

func (t *CustomTransport) RoundTrip(req *http.Request) (*http.Response, error) {
	// Parse the request URL and add the query parameter
	query := req.URL.Query()
	query.Add("api_key", "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
	req.URL.RawQuery = query.Encode()

	// Use the original Transport to send the request
	return t.Transport.RoundTrip(req)
}

func main () {
	client := fdc.NewAPIClient(&fdc.Configuration{
		BasePath:  "https://api.nal.usda.gov/fdc",
		UserAgent: "fooddata-central-client-go/0.1.0",
		HTTPClient: &http.Client{
			Transport: &CustomTransport{
				Transport: http.DefaultTransport,
			},
		},
	})

	// Use the client to call an API endpoint
	client.FDCApi.GetFoodsSearch(ctx, "potatoes", &fdc.FDCApiGetFoodsSearchOpts{})
}

Author

  1. U.S. Department of Agriculture. Agricultural Research Service.

Sources

Dependencies

go install -v github.com/go-critic/go-critic/cmd/gocritic@latest
go install github.com/fzipp/gocyclo/cmd/gocyclo@latest
go install golang.org/x/tools/cmd/goimports@latest

Documentation

Overview

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Food Data Central API * * The FoodData Central API provides REST access to FoodData Central (FDC). It is intended primarily to assist application developers wishing to incorporate nutrient data into their applications or websites. To take full advantage of the API, developers should familiarize themselves with the database by reading the database documentation available via links on [Data Type Documentation](https://fdc.nal.usda.gov/data-documentation.html). This documentation provides the detailed definitions and descriptions needed to understand the data elements referenced in the API documentation. Additional details about the API including rate limits, access, and licensing are available on the [FDC website](https://fdc.nal.usda.gov/api-guide.html) * * API version: 1.0.1 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

Index

Constants

This section is empty.

Variables

View Source
var (
	// ContextOAuth2 takes a oauth2.TokenSource as authentication for the request.
	ContextOAuth2 = contextKey("token")

	// ContextBasicAuth takes BasicAuth as authentication for the request.
	ContextBasicAuth = contextKey("basic")

	// ContextAccessToken takes a string oauth2 access token as authentication for the request.
	ContextAccessToken = contextKey("accesstoken")

	// ContextAPIKey takes an APIKey as authentication for the request
	ContextAPIKey = contextKey("apikey")
)

Functions

func CacheExpires

func CacheExpires(r *http.Response) time.Time

CacheExpires helper function to determine remaining time before repeating a request.

Types

type APIClient

type APIClient struct {
	FDCApi *FDCApiService
	// contains filtered or unexported fields
}

APIClient manages communication with the Food Data Central API API v1.0.1 In most cases there should be only one, shared, APIClient.

func NewAPIClient

func NewAPIClient(cfg *Configuration) *APIClient

NewAPIClient creates a new API client. Requires a userAgent string describing your application. optionally a custom http.Client to allow for advanced features such as caching.

func (*APIClient) ChangeBasePath

func (c *APIClient) ChangeBasePath(path string)

Change base path to allow switching to mocks

type APIKey

type APIKey struct {
	Key    string
	Prefix string
}

APIKey provides API key based authentication to a request passed via context using ContextAPIKey

type APIResponse

type APIResponse struct {
	*http.Response `json:"-"`
	Message        string `json:"message,omitempty"`
	// Operation is the name of the swagger operation.
	Operation string `json:"operation,omitempty"`
	// RequestURL is the request URL. This value is always available, even if the
	// embedded *http.Response is nil.
	RequestURL string `json:"url,omitempty"`
	// Method is the HTTP method used for the request.  This value is always
	// available, even if the embedded *http.Response is nil.
	Method string `json:"method,omitempty"`
	// Payload holds the contents of the response body (which may be nil or empty).
	// This is provided here as the raw response.Body() reader will have already
	// been drained.
	Payload []byte `json:"-"`
}

func NewAPIResponse

func NewAPIResponse(r *http.Response) *APIResponse

func NewAPIResponseWithError

func NewAPIResponseWithError(errorMessage string) *APIResponse

type AbridgedFoodItem

type AbridgedFoodItem struct {
	DataType        string                 `json:"dataType"`
	Description     string                 `json:"description"`
	FdcId           int32                  `json:"fdcId"`
	FoodNutrients   []AbridgedFoodNutrient `json:"foodNutrients,omitempty"`
	PublicationDate string                 `json:"publicationDate,omitempty"`
	// only applies to Branded Foods
	BrandOwner string `json:"brandOwner,omitempty"`
	// only applies to Branded Foods
	GtinUpc string `json:"gtinUpc,omitempty"`
	// only applies to Foundation and SRLegacy Foods
	NdbNumber int32 `json:"ndbNumber,omitempty"`
	// only applies to Survey Foods
	FoodCode string `json:"foodCode,omitempty"`
}

type AbridgedFoodNutrient

type AbridgedFoodNutrient struct {
	Number                int32   `json:"number,omitempty"`
	Name                  string  `json:"name,omitempty"`
	Amount                float32 `json:"amount,omitempty"`
	UnitName              string  `json:"unitName,omitempty"`
	DerivationCode        string  `json:"derivationCode,omitempty"`
	DerivationDescription string  `json:"derivationDescription,omitempty"`
}

type BasicAuth

type BasicAuth struct {
	UserName string `json:"userName,omitempty"`
	Password string `json:"password,omitempty"`
}

BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth

type BrandedFoodItem

type BrandedFoodItem struct {
	FdcId                    int32                          `json:"fdcId"`
	AvailableDate            string                         `json:"availableDate,omitempty"`
	BrandOwner               string                         `json:"brandOwner,omitempty"`
	DataSource               string                         `json:"dataSource,omitempty"`
	DataType                 string                         `json:"dataType"`
	Description              string                         `json:"description"`
	FoodClass                string                         `json:"foodClass,omitempty"`
	GtinUpc                  string                         `json:"gtinUpc,omitempty"`
	HouseholdServingFullText string                         `json:"householdServingFullText,omitempty"`
	Ingredients              string                         `json:"ingredients,omitempty"`
	ModifiedDate             string                         `json:"modifiedDate,omitempty"`
	PublicationDate          string                         `json:"publicationDate,omitempty"`
	ServingSize              interface{}                    `json:"servingSize,omitempty"`
	ServingSizeUnit          string                         `json:"servingSizeUnit,omitempty"`
	PreparationStateCode     string                         `json:"preparationStateCode,omitempty"`
	BrandedFoodCategory      string                         `json:"brandedFoodCategory,omitempty"`
	TradeChannel             []string                       `json:"tradeChannel,omitempty"`
	GpcClassCode             int32                          `json:"gpcClassCode,omitempty"`
	FoodNutrients            []FoodNutrient                 `json:"foodNutrients,omitempty"`
	FoodUpdateLog            []FoodUpdateLog                `json:"foodUpdateLog,omitempty"`
	LabelNutrients           *BrandedFoodItemLabelNutrients `json:"labelNutrients,omitempty"`
	PackageWeight            string                         `json:"packageWeight,omitempty"`
	ShortDescription         string                         `json:"shortDescription,omitempty"`
	DiscontinuedDate         string                         `json:"discontinuedDate,omitempty"`
	BrandName                string                         `json:"brandName,omitempty"`
	SubbrandName             string                         `json:"subbrandName,omitempty"`
	MarketCountry            string                         `json:"marketCountry,omitempty"`
}

type BrandedFoodItemLabelNutrients

type BrandedFoodItemLabelNutrients struct {
	Fat           *BrandedFoodItemLabelNutrientsFat           `json:"fat,omitempty"`
	SaturatedFat  *BrandedFoodItemLabelNutrientsSaturatedFat  `json:"saturatedFat,omitempty"`
	TransFat      *BrandedFoodItemLabelNutrientsTransFat      `json:"transFat,omitempty"`
	Cholesterol   *BrandedFoodItemLabelNutrientsTransFat      `json:"cholesterol,omitempty"`
	Sodium        *BrandedFoodItemLabelNutrientsTransFat      `json:"sodium,omitempty"`
	Carbohydrates *BrandedFoodItemLabelNutrientsCarbohydrates `json:"carbohydrates,omitempty"`
	Fiber         *BrandedFoodItemLabelNutrientsFiber         `json:"fiber,omitempty"`
	Sugars        *BrandedFoodItemLabelNutrientsSugars        `json:"sugars,omitempty"`
	Protein       *BrandedFoodItemLabelNutrientsProtein       `json:"protein,omitempty"`
	Calcium       *BrandedFoodItemLabelNutrientsCalcium       `json:"calcium,omitempty"`
	Iron          *BrandedFoodItemLabelNutrientsIron          `json:"iron,omitempty"`
	Potassium     *BrandedFoodItemLabelNutrientsPotassium     `json:"potassium,omitempty"`
	Calories      *BrandedFoodItemLabelNutrientsCalories      `json:"calories,omitempty"`
}

type BrandedFoodItemLabelNutrientsCalcium

type BrandedFoodItemLabelNutrientsCalcium struct {
	Value float32 `json:"value,omitempty"`
}

type BrandedFoodItemLabelNutrientsCalories

type BrandedFoodItemLabelNutrientsCalories struct {
	Value float32 `json:"value,omitempty"`
}

type BrandedFoodItemLabelNutrientsCarbohydrates

type BrandedFoodItemLabelNutrientsCarbohydrates struct {
	Value float32 `json:"value,omitempty"`
}

type BrandedFoodItemLabelNutrientsFat

type BrandedFoodItemLabelNutrientsFat struct {
	Value float32 `json:"value,omitempty"`
}

type BrandedFoodItemLabelNutrientsFiber

type BrandedFoodItemLabelNutrientsFiber struct {
	Value float32 `json:"value,omitempty"`
}

type BrandedFoodItemLabelNutrientsIron

type BrandedFoodItemLabelNutrientsIron struct {
	Value float32 `json:"value,omitempty"`
}

type BrandedFoodItemLabelNutrientsPotassium

type BrandedFoodItemLabelNutrientsPotassium struct {
	Value float32 `json:"value,omitempty"`
}

type BrandedFoodItemLabelNutrientsProtein

type BrandedFoodItemLabelNutrientsProtein struct {
	Value float32 `json:"value,omitempty"`
}

type BrandedFoodItemLabelNutrientsSaturatedFat

type BrandedFoodItemLabelNutrientsSaturatedFat struct {
	Value float32 `json:"value,omitempty"`
}

type BrandedFoodItemLabelNutrientsSugars

type BrandedFoodItemLabelNutrientsSugars struct {
	Value float32 `json:"value,omitempty"`
}

type BrandedFoodItemLabelNutrientsTransFat

type BrandedFoodItemLabelNutrientsTransFat struct {
	Value float32 `json:"value,omitempty"`
}

type Configuration

type Configuration struct {
	BasePath      string            `json:"basePath,omitempty"`
	Host          string            `json:"host,omitempty"`
	Scheme        string            `json:"scheme,omitempty"`
	DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
	UserAgent     string            `json:"userAgent,omitempty"`
	HTTPClient    *http.Client
}

func NewConfiguration

func NewConfiguration() *Configuration

func (*Configuration) AddDefaultHeader

func (c *Configuration) AddDefaultHeader(key string, value string)

type FDCApiGetFoodOpts

type FDCApiGetFoodOpts struct {
	Format    optional.String
	Nutrients optional.Interface
}

type FDCApiGetFoodsListOpts

type FDCApiGetFoodsListOpts struct {
	DataType   optional.Interface
	PageSize   optional.Int32
	PageNumber optional.Int32
	SortBy     optional.String
	SortOrder  optional.String
}

type FDCApiGetFoodsOpts

type FDCApiGetFoodsOpts struct {
	Format    optional.String
	Nutrients optional.Interface
}

type FDCApiGetFoodsSearchOpts

type FDCApiGetFoodsSearchOpts struct {
	DataType   optional.Interface
	PageSize   optional.Int32
	PageNumber optional.Int32
	SortBy     optional.String
	SortOrder  optional.String
	BrandOwner optional.String
}

type FDCApiService

type FDCApiService service

func (*FDCApiService) GetFood

func (a *FDCApiService) GetFood(ctx context.Context, fdcId string, localVarOptionals *FDCApiGetFoodOpts) (InlineResponse200, *http.Response, error)

func (*FDCApiService) GetFoods

func (a *FDCApiService) GetFoods(ctx context.Context, fdcIds []string, localVarOptionals *FDCApiGetFoodsOpts) ([]interface{}, *http.Response, error)

func (*FDCApiService) GetFoodsList

func (a *FDCApiService) GetFoodsList(ctx context.Context, localVarOptionals *FDCApiGetFoodsListOpts) ([]AbridgedFoodItem, *http.Response, error)

func (*FDCApiService) GetFoodsSearch

func (a *FDCApiService) GetFoodsSearch(ctx context.Context, query string, localVarOptionals *FDCApiGetFoodsSearchOpts) (SearchResult, *http.Response, error)

func (*FDCApiService) GetJsonSpec

func (a *FDCApiService) GetJsonSpec(ctx context.Context) (*http.Response, error)

FDCApiService Returns this documentation in JSON format The OpenAPI 3.0 specification for the FDC API rendered as JSON (JavaScript Object Notation)

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

func (*FDCApiService) GetYamlSpec

func (a *FDCApiService) GetYamlSpec(ctx context.Context) (*http.Response, error)

FDCApiService Returns this documentation in JSON format The OpenAPI 3.0 specification for the FDC API rendered as YAML (YAML Ain't Markup Language)

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

func (*FDCApiService) PostFoods

func (a *FDCApiService) PostFoods(ctx context.Context, body FoodsCriteria) ([]interface{}, *http.Response, error)

FDCApiService Fetches details for multiple food items using input FDC IDs Retrieves a list of food items by a list of up to 20 FDC IDs. Optional format and nutrients can be specified. Invalid FDC ID's or ones that are not found are omitted and an empty set is returned if there are no matches.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param body

@return []interface{}

func (*FDCApiService) PostFoodsList

func (a *FDCApiService) PostFoodsList(ctx context.Context, body FoodListCriteria) ([]AbridgedFoodItem, *http.Response, error)

FDCApiService Returns a paged list of foods, in the 'abridged' format Retrieves a paged list of foods. Use the pageNumber parameter to page through the entire result set.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param body

@return []AbridgedFoodItem

func (*FDCApiService) PostFoodsSearch

func (a *FDCApiService) PostFoodsSearch(ctx context.Context, body FoodSearchCriteria) (SearchResult, *http.Response, error)

FDCApiService Returns a list of foods that matched search (query) keywords Search for foods using keywords. Results can be filtered by dataType and there are options for result page sizes or sorting.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param body The query string may also include standard [search operators](https://fdc.nal.usda.gov/help.html#bkmk-2)

@return SearchResult

type FoodAttribute

type FoodAttribute struct {
	Id                int32                           `json:"id,omitempty"`
	SequenceNumber    int32                           `json:"sequenceNumber,omitempty"`
	Value             interface{}                     `json:"value,omitempty"`
	FoodAttributeType *FoodAttributeFoodAttributeType `json:"FoodAttributeType,omitempty"`
}

type FoodAttributeFoodAttributeType

type FoodAttributeFoodAttributeType struct {
	Id          int32  `json:"id,omitempty"`
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
}

type FoodCategory

type FoodCategory struct {
	Id          int32  `json:"id,omitempty"`
	Code        string `json:"code,omitempty"`
	Description string `json:"description,omitempty"`
}

type FoodComponent

type FoodComponent struct {
	Id              int32   `json:"id,omitempty"`
	Name            string  `json:"name,omitempty"`
	DataPoints      int32   `json:"dataPoints,omitempty"`
	GramWeight      float64 `json:"gramWeight,omitempty"`
	IsRefuse        bool    `json:"isRefuse,omitempty"`
	MinYearAcquired int32   `json:"minYearAcquired,omitempty"`
	PercentWeight   float64 `json:"percentWeight,omitempty"`
}

type FoodListCriteria

type FoodListCriteria struct {
	// Optional. Filter on a specific data type; specify one or more values in an array.
	DataType []string `json:"dataType,omitempty"`
	// Optional. Maximum number of results to return for the current page. Default is 50.
	PageSize int32 `json:"pageSize,omitempty"`
	// Optional. Page number to retrieve. The offset into the overall result set is expressed as (pageNumber * pageSize)
	PageNumber int32 `json:"pageNumber,omitempty"`
	// Optional. Specify one of the possible values to sort by that field. Note, dataType.keyword will be dataType and lowercaseDescription.keyword will be description in future releases.
	SortBy string `json:"sortBy,omitempty"`
	// Optional. The sort direction for the results. Only applicable if sortBy is specified.
	SortOrder string `json:"sortOrder,omitempty"`
}

JSON for request body of 'list' POST request

type FoodNutrient

type FoodNutrient struct {
	Id                      int32                    `json:"id"`
	Amount                  float32                  `json:"amount,omitempty"`
	DataPoints              int32                    `json:"dataPoints,omitempty"`
	Min                     float32                  `json:"min,omitempty"`
	Max                     float32                  `json:"max,omitempty"`
	Median                  float32                  `json:"median,omitempty"`
	Type_                   string                   `json:"type,omitempty"`
	Nutrient                *Nutrient                `json:"nutrient,omitempty"`
	FoodNutrientDerivation  *FoodNutrientDerivation  `json:"foodNutrientDerivation,omitempty"`
	NutrientAnalysisDetails *NutrientAnalysisDetails `json:"nutrientAnalysisDetails,omitempty"`
}

type FoodNutrientDerivation

type FoodNutrientDerivation struct {
	Id                 int32               `json:"id,omitempty"`
	Code               string              `json:"code,omitempty"`
	Description        string              `json:"description,omitempty"`
	FoodNutrientSource *FoodNutrientSource `json:"foodNutrientSource,omitempty"`
}

type FoodNutrientSource

type FoodNutrientSource struct {
	Id          int32  `json:"id,omitempty"`
	Code        string `json:"code,omitempty"`
	Description string `json:"description,omitempty"`
}

type FoodPortion

type FoodPortion struct {
	Id                 int32        `json:"id,omitempty"`
	Amount             float32      `json:"amount,omitempty"`
	DataPoints         int32        `json:"dataPoints,omitempty"`
	GramWeight         float32      `json:"gramWeight,omitempty"`
	MinYearAcquired    int32        `json:"minYearAcquired,omitempty"`
	Modifier           string       `json:"modifier,omitempty"`
	PortionDescription string       `json:"portionDescription,omitempty"`
	SequenceNumber     int32        `json:"sequenceNumber,omitempty"`
	MeasureUnit        *MeasureUnit `json:"measureUnit,omitempty"`
}

type FoodSearchCriteria

type FoodSearchCriteria struct {
	// Search terms to use in the search. The string may also include standard [search operators](https://fdc.nal.usda.gov/help.html#bkmk-2)
	Query string `json:"query,omitempty"`
	// Optional. Filter on a specific data type; specify one or more values in an array.
	DataType []string `json:"dataType,omitempty"`
	// Optional. Maximum number of results to return for the current page. Default is 50.
	PageSize int32 `json:"pageSize,omitempty"`
	// Optional. Page number to retrieve. The offset into the overall result set is expressed as (pageNumber * pageSize)
	PageNumber int32 `json:"pageNumber,omitempty"`
	// Optional. Specify one of the possible values to sort by that field. Note, dataType.keyword will be dataType and description.keyword will be description in future releases.
	SortBy string `json:"sortBy,omitempty"`
	// Optional. The sort direction for the results. Only applicable if sortBy is specified.
	SortOrder string `json:"sortOrder,omitempty"`
	// Optional. Filter results based on the brand owner of the food. Only applies to Branded Foods.
	BrandOwner string `json:"brandOwner,omitempty"`
	// Optional. Filter foods containing any of the specified trade channels.
	TradeChannel []string `json:"tradeChannel,omitempty"`
	// Filter foods published on or after this date. Format: YYYY-MM-DD
	StartDate string `json:"startDate,omitempty"`
	// Filter foods published on or before this date. Format: YYYY-MM-DD
	EndDate string `json:"endDate,omitempty"`
}

A copy of the criteria that were used in the search.

type FoodUpdateLog

type FoodUpdateLog struct {
	FdcId                    int32           `json:"fdcId,omitempty"`
	AvailableDate            string          `json:"availableDate,omitempty"`
	BrandOwner               string          `json:"brandOwner,omitempty"`
	DataSource               string          `json:"dataSource,omitempty"`
	DataType                 string          `json:"dataType,omitempty"`
	Description              string          `json:"description,omitempty"`
	FoodClass                string          `json:"foodClass,omitempty"`
	GtinUpc                  string          `json:"gtinUpc,omitempty"`
	HouseholdServingFullText string          `json:"householdServingFullText,omitempty"`
	Ingredients              string          `json:"ingredients,omitempty"`
	ModifiedDate             string          `json:"modifiedDate,omitempty"`
	PublicationDate          string          `json:"publicationDate,omitempty"`
	ServingSize              interface{}     `json:"servingSize,omitempty"`
	ServingSizeUnit          string          `json:"servingSizeUnit,omitempty"`
	BrandedFoodCategory      string          `json:"brandedFoodCategory,omitempty"`
	Changes                  string          `json:"changes,omitempty"`
	FoodAttributes           []FoodAttribute `json:"foodAttributes,omitempty"`
}

type FoodsCriteria

type FoodsCriteria struct {
	// List of multiple FDC ID's
	FdcIds []int32 `json:"fdcIds,omitempty"`
	// Optional. 'abridged' for an abridged set of elements, 'full' for all elements (default).
	Format string `json:"format,omitempty"`
	// Optional. List of up to 25 nutrient numbers. Only the nutrient information for the specified nutrients will be returned.  If a food does not have any matching nutrients, the food will be returned with an empty foodNutrients element.
	Nutrients []int32 `json:"nutrients,omitempty"`
}

JSON for request body of 'foods' POST request. Retrieves a list of food items by a list of up to 20 FDC IDs. Optional format and nutrients can be specified. Invalid FDC ID's or ones that are not found are omitted and an empty set is returned if there are no matches.

type FoundationFoodItem

type FoundationFoodItem struct {
	FdcId                     int32                       `json:"fdcId"`
	DataType                  string                      `json:"dataType"`
	Description               string                      `json:"description"`
	FoodClass                 string                      `json:"foodClass,omitempty"`
	FootNote                  string                      `json:"footNote,omitempty"`
	IsHistoricalReference     bool                        `json:"isHistoricalReference,omitempty"`
	NdbNumber                 int32                       `json:"ndbNumber,omitempty"`
	PublicationDate           string                      `json:"publicationDate,omitempty"`
	ScientificName            string                      `json:"scientificName,omitempty"`
	FoodCategory              *FoodCategory               `json:"foodCategory,omitempty"`
	FoodComponents            []FoodComponent             `json:"foodComponents,omitempty"`
	FoodNutrients             []FoodNutrient              `json:"foodNutrients,omitempty"`
	FoodPortions              []FoodPortion               `json:"foodPortions,omitempty"`
	InputFoods                []InputFoodFoundation       `json:"inputFoods,omitempty"`
	NutrientConversionFactors []NutrientConversionFactors `json:"nutrientConversionFactors,omitempty"`
}

type GenericSwaggerError

type GenericSwaggerError struct {
	// contains filtered or unexported fields
}

GenericSwaggerError Provides access to the body, error and model on returned errors.

func (GenericSwaggerError) Body

func (e GenericSwaggerError) Body() []byte

Body returns the raw bytes of the response

func (GenericSwaggerError) Error

func (e GenericSwaggerError) Error() string

Error returns non-empty string if there was an error.

func (GenericSwaggerError) Model

func (e GenericSwaggerError) Model() interface{}

Model returns the unpacked model of the error

type InlineResponse200

func (*InlineResponse200) UnmarshalJSON added in v0.3.0

func (ir *InlineResponse200) UnmarshalJSON(data []byte) error

type InputFoodFoundation

type InputFoodFoundation struct {
	Id              int32           `json:"id,omitempty"`
	FoodDescription string          `json:"foodDescription,omitempty"`
	InputFood       *SampleFoodItem `json:"inputFood,omitempty"`
}

applies to Foundation foods. Not all inputFoods will have all fields.

type InputFoodSurvey

type InputFoodSurvey struct {
	Id                    int32            `json:"id,omitempty"`
	Amount                float32          `json:"amount,omitempty"`
	FoodDescription       string           `json:"foodDescription,omitempty"`
	IngredientCode        int32            `json:"ingredientCode,omitempty"`
	IngredientDescription string           `json:"ingredientDescription,omitempty"`
	IngredientWeight      float32          `json:"ingredientWeight,omitempty"`
	PortionCode           string           `json:"portionCode,omitempty"`
	PortionDescription    string           `json:"portionDescription,omitempty"`
	SequenceNumber        int32            `json:"sequenceNumber,omitempty"`
	SurveyFlag            int32            `json:"surveyFlag,omitempty"`
	Unit                  string           `json:"unit,omitempty"`
	InputFood             *SurveyFoodItem  `json:"inputFood,omitempty"`
	RetentionFactor       *RetentionFactor `json:"retentionFactor,omitempty"`
}

applies to Survey (FNDDS). Not all inputFoods will have all fields.

type MeasureUnit

type MeasureUnit struct {
	Id           int32  `json:"id,omitempty"`
	Abbreviation string `json:"abbreviation,omitempty"`
	Name         string `json:"name,omitempty"`
}

type Nutrient

type Nutrient struct {
	Id       int32  `json:"id,omitempty"`
	Number   string `json:"number,omitempty"`
	Name     string `json:"name,omitempty"`
	Rank     int32  `json:"rank,omitempty"`
	UnitName string `json:"unitName,omitempty"`
}

a food nutrient

type NutrientAcquisitionDetails

type NutrientAcquisitionDetails struct {
	SampleUnitId int32  `json:"sampleUnitId,omitempty"`
	PurchaseDate string `json:"purchaseDate,omitempty"`
	StoreCity    string `json:"storeCity,omitempty"`
	StoreState   string `json:"storeState,omitempty"`
}

type NutrientAnalysisDetails

type NutrientAnalysisDetails struct {
	SubSampleId                  int32                        `json:"subSampleId,omitempty"`
	Amount                       float32                      `json:"amount,omitempty"`
	NutrientId                   int32                        `json:"nutrientId,omitempty"`
	LabMethodDescription         string                       `json:"labMethodDescription,omitempty"`
	LabMethodOriginalDescription string                       `json:"labMethodOriginalDescription,omitempty"`
	LabMethodLink                string                       `json:"labMethodLink,omitempty"`
	LabMethodTechnique           string                       `json:"labMethodTechnique,omitempty"`
	NutrientAcquisitionDetails   []NutrientAcquisitionDetails `json:"nutrientAcquisitionDetails,omitempty"`
}

type NutrientConversionFactors

type NutrientConversionFactors struct {
	Type_ string  `json:"type,omitempty"`
	Value float32 `json:"value,omitempty"`
}

type RetentionFactor

type RetentionFactor struct {
	Id          int32  `json:"id,omitempty"`
	Code        int32  `json:"code,omitempty"`
	Description string `json:"description,omitempty"`
}

type SampleFoodItem

type SampleFoodItem struct {
	FdcId           int32          `json:"fdcId"`
	Datatype        string         `json:"datatype,omitempty"`
	Description     string         `json:"description"`
	FoodClass       string         `json:"foodClass,omitempty"`
	PublicationDate string         `json:"publicationDate,omitempty"`
	FoodAttributes  []FoodCategory `json:"foodAttributes,omitempty"`
}

type SearchResult

type SearchResult struct {
	FoodSearchCriteria *FoodSearchCriteria `json:"foodSearchCriteria,omitempty"`
	// The total number of foods found matching the search criteria.
	TotalHits int32 `json:"totalHits,omitempty"`
	// The current page of results being returned.
	CurrentPage int32 `json:"currentPage,omitempty"`
	// The total number of pages found matching the search criteria.
	TotalPages int32 `json:"totalPages,omitempty"`
	// The list of foods found matching the search criteria. See Food Fields below.
	Foods []SearchResultFood `json:"foods,omitempty"`
}

type SearchResultFood

type SearchResultFood struct {
	// Unique ID of the food.
	FdcId int32 `json:"fdcId"`
	// The type of the food data.
	DataType string `json:"dataType,omitempty"`
	// The description of the food.
	Description string `json:"description"`
	// Any A unique ID identifying the food within FNDDS.
	FoodCode      string                 `json:"foodCode,omitempty"`
	FoodNutrients []AbridgedFoodNutrient `json:"foodNutrients,omitempty"`
	// Date the item was published to FDC.
	PublicationDate string `json:"publicationDate,omitempty"`
	// The scientific name of the food.
	ScientificName string `json:"scientificName,omitempty"`
	// Brand owner for the food. Only applies to Branded Foods.
	BrandOwner string `json:"brandOwner,omitempty"`
	// GTIN or UPC code identifying the food. Only applies to Branded Foods.
	GtinUpc string `json:"gtinUpc,omitempty"`
	// The list of ingredients (as it appears on the product label). Only applies to Branded Foods.
	Ingredients string `json:"ingredients,omitempty"`
	// Unique number assigned for foundation foods. Only applies to Foundation and SRLegacy Foods.
	NdbNumber int32 `json:"ndbNumber,omitempty"`
	// Any additional descriptions of the food.
	AdditionalDescriptions string `json:"additionalDescriptions,omitempty"`
	// allHighlightFields
	AllHighlightFields string `json:"allHighlightFields,omitempty"`
	// Relative score indicating how well the food matches the search criteria.
	Score float32 `json:"score,omitempty"`
}

type SrLegacyFoodItem

type SrLegacyFoodItem struct {
	FdcId                     int32                       `json:"fdcId"`
	DataType                  string                      `json:"dataType"`
	Description               string                      `json:"description"`
	FoodClass                 string                      `json:"foodClass,omitempty"`
	IsHistoricalReference     bool                        `json:"isHistoricalReference,omitempty"`
	NdbNumber                 int32                       `json:"ndbNumber,omitempty"`
	PublicationDate           string                      `json:"publicationDate,omitempty"`
	ScientificName            string                      `json:"scientificName,omitempty"`
	FoodCategory              *FoodCategory               `json:"foodCategory,omitempty"`
	FoodNutrients             []FoodNutrient              `json:"foodNutrients,omitempty"`
	NutrientConversionFactors []NutrientConversionFactors `json:"nutrientConversionFactors,omitempty"`
}

type SurveyFoodItem

type SurveyFoodItem struct {
	FdcId             int32              `json:"fdcId"`
	Datatype          string             `json:"datatype,omitempty"`
	Description       string             `json:"description"`
	EndDate           string             `json:"endDate,omitempty"`
	FoodClass         string             `json:"foodClass,omitempty"`
	FoodCode          string             `json:"foodCode,omitempty"`
	PublicationDate   string             `json:"publicationDate,omitempty"`
	StartDate         string             `json:"startDate,omitempty"`
	FoodNutrients     []FoodNutrient     `json:"foodNutrients,omitempty"`
	FoodAttributes    []FoodAttribute    `json:"foodAttributes,omitempty"`
	FoodPortions      []FoodPortion      `json:"foodPortions,omitempty"`
	InputFoods        []InputFoodSurvey  `json:"inputFoods,omitempty"`
	WweiaFoodCategory *WweiaFoodCategory `json:"wweiaFoodCategory,omitempty"`
}

type WweiaFoodCategory

type WweiaFoodCategory struct {
	WweiaFoodCategoryCode        int32  `json:"wweiaFoodCategoryCode,omitempty"`
	WweiaFoodCategoryDescription string `json:"wweiaFoodCategoryDescription,omitempty"`
}

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL