Skip to content

Latest commit

 

History

History
405 lines (268 loc) · 12.3 KB

ProductsAPI.md

File metadata and controls

405 lines (268 loc) · 12.3 KB

\ProductsAPI

All URIs are relative to https://api-v2.fattureincloud.it

Method HTTP request Description
CreateProduct Post /c/{company_id}/products Create Product
DeleteProduct Delete /c/{company_id}/products/{product_id} Delete Product
GetProduct Get /c/{company_id}/products/{product_id} Get Product
ListProducts Get /c/{company_id}/products List Products
ModifyProduct Put /c/{company_id}/products/{product_id} Modify Product

CreateProduct

CreateProductResponse CreateProduct(ctx, companyId).CreateProductRequest(createProductRequest).Execute()

Create Product

Example

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"
	fattureincloudapi "github.com/fattureincloud/fattureincloud-go-sdk/v2/api"
	fattureincloud "github.com/fattureincloud/fattureincloud-go-sdk/v2/model"
)

func main() {
	companyId := int32(12345) // int32 | The ID of the company.
	createProductRequest := *fattureincloud.NewCreateProductRequest() // CreateProductRequest |  (optional)

	auth := context.WithValue(context.Background(), fattureincloudapi.ContextAccessToken, "ACCESS_TOKEN")
	configuration := fattureincloudapi.NewConfiguration()
	apiClient := fattureincloudapi.NewAPIClient(configuration)
	resp, r, err := apiClient.ProductsAPI.CreateProduct(auth, companyId).CreateProductRequest(createProductRequest).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `ProductsAPI.CreateProduct``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `CreateProduct`: CreateProductResponse
	json.NewEncoder(os.Stdout).Encode(resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
companyId int32 The ID of the company.

Other Parameters

Other parameters are passed through a pointer to a apiCreateProductRequest struct via the builder pattern

Name Type Description Notes

createProductRequest | CreateProductRequest | |

Return type

CreateProductResponse

Authorization

OAuth2AuthenticationCodeFlow

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

DeleteProduct

DeleteProduct(ctx, companyId, productId).Execute()

Delete Product

Example

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"
	fattureincloudapi "github.com/fattureincloud/fattureincloud-go-sdk/v2/api"
	fattureincloud "github.com/fattureincloud/fattureincloud-go-sdk/v2/model"
)

func main() {
	companyId := int32(12345) // int32 | The ID of the company.
	productId := int32(56) // int32 | The ID of the product.

	auth := context.WithValue(context.Background(), fattureincloudapi.ContextAccessToken, "ACCESS_TOKEN")
	configuration := fattureincloudapi.NewConfiguration()
	apiClient := fattureincloudapi.NewAPIClient(configuration)
	resp, r, err := apiClient.ProductsAPI.DeleteProduct(auth, companyId, productId).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `ProductsAPI.DeleteProduct``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
companyId int32 The ID of the company.
productId int32 The ID of the product.

Other Parameters

Other parameters are passed through a pointer to a apiDeleteProductRequest struct via the builder pattern

Name Type Description Notes

Return type

(empty response body)

Authorization

OAuth2AuthenticationCodeFlow

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetProduct

GetProductResponse GetProduct(ctx, companyId, productId).Fields(fields).Fieldset(fieldset).Execute()

Get Product

Example

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"
	fattureincloudapi "github.com/fattureincloud/fattureincloud-go-sdk/v2/api"
	fattureincloud "github.com/fattureincloud/fattureincloud-go-sdk/v2/model"
)

func main() {
	companyId := int32(12345) // int32 | The ID of the company.
	productId := int32(56) // int32 | The ID of the product.
	fields := "fields_example" // string | List of comma-separated fields. (optional)
	fieldset := "fieldset_example" // string | Name of the fieldset. (optional)

	auth := context.WithValue(context.Background(), fattureincloudapi.ContextAccessToken, "ACCESS_TOKEN")
	configuration := fattureincloudapi.NewConfiguration()
	apiClient := fattureincloudapi.NewAPIClient(configuration)
	resp, r, err := apiClient.ProductsAPI.GetProduct(auth, companyId, productId).Fields(fields).Fieldset(fieldset).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `ProductsAPI.GetProduct``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetProduct`: GetProductResponse
	json.NewEncoder(os.Stdout).Encode(resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
companyId int32 The ID of the company.
productId int32 The ID of the product.

Other Parameters

Other parameters are passed through a pointer to a apiGetProductRequest struct via the builder pattern

Name Type Description Notes

fields | string | List of comma-separated fields. | fieldset | string | Name of the fieldset. |

Return type

GetProductResponse

Authorization

OAuth2AuthenticationCodeFlow

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListProducts

ListProductsResponse ListProducts(ctx, companyId).Fields(fields).Fieldset(fieldset).Sort(sort).Page(page).PerPage(perPage).Q(q).Execute()

List Products

Example

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"
	fattureincloudapi "github.com/fattureincloud/fattureincloud-go-sdk/v2/api"
	fattureincloud "github.com/fattureincloud/fattureincloud-go-sdk/v2/model"
)

func main() {
	companyId := int32(12345) // int32 | The ID of the company.
	fields := "fields_example" // string | List of comma-separated fields. (optional)
	fieldset := "fieldset_example" // string | Name of the fieldset. (optional)
	sort := "sort_example" // string | List of comma-separated fields for result sorting (minus for desc sorting). (optional)
	page := int32(56) // int32 | The page to retrieve. (optional) (default to 1)
	perPage := int32(56) // int32 | The size of the page. (optional) (default to 5)
	q := "q_example" // string | Query for filtering the results. (optional)

	auth := context.WithValue(context.Background(), fattureincloudapi.ContextAccessToken, "ACCESS_TOKEN")
	configuration := fattureincloudapi.NewConfiguration()
	apiClient := fattureincloudapi.NewAPIClient(configuration)
	resp, r, err := apiClient.ProductsAPI.ListProducts(auth, companyId).Fields(fields).Fieldset(fieldset).Sort(sort).Page(page).PerPage(perPage).Q(q).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `ProductsAPI.ListProducts``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `ListProducts`: ListProductsResponse
	json.NewEncoder(os.Stdout).Encode(resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
companyId int32 The ID of the company.

Other Parameters

Other parameters are passed through a pointer to a apiListProductsRequest struct via the builder pattern

Name Type Description Notes

fields | string | List of comma-separated fields. | fieldset | string | Name of the fieldset. | sort | string | List of comma-separated fields for result sorting (minus for desc sorting). | page | int32 | The page to retrieve. | [default to 1] perPage | int32 | The size of the page. | [default to 5] q | string | Query for filtering the results. |

Return type

ListProductsResponse

Authorization

OAuth2AuthenticationCodeFlow

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ModifyProduct

ModifyProductResponse ModifyProduct(ctx, companyId, productId).ModifyProductRequest(modifyProductRequest).Execute()

Modify Product

Example

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"
	fattureincloudapi "github.com/fattureincloud/fattureincloud-go-sdk/v2/api"
	fattureincloud "github.com/fattureincloud/fattureincloud-go-sdk/v2/model"
)

func main() {
	companyId := int32(12345) // int32 | The ID of the company.
	productId := int32(56) // int32 | The ID of the product.
	modifyProductRequest := *fattureincloud.NewModifyProductRequest() // ModifyProductRequest | Modified product details. (optional)

	auth := context.WithValue(context.Background(), fattureincloudapi.ContextAccessToken, "ACCESS_TOKEN")
	configuration := fattureincloudapi.NewConfiguration()
	apiClient := fattureincloudapi.NewAPIClient(configuration)
	resp, r, err := apiClient.ProductsAPI.ModifyProduct(auth, companyId, productId).ModifyProductRequest(modifyProductRequest).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `ProductsAPI.ModifyProduct``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `ModifyProduct`: ModifyProductResponse
	json.NewEncoder(os.Stdout).Encode(resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
companyId int32 The ID of the company.
productId int32 The ID of the product.

Other Parameters

Other parameters are passed through a pointer to a apiModifyProductRequest struct via the builder pattern

Name Type Description Notes

modifyProductRequest | ModifyProductRequest | Modified product details. |

Return type

ModifyProductResponse

Authorization

OAuth2AuthenticationCodeFlow

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]