Skip to content

Latest commit

 

History

History
284 lines (186 loc) · 8.21 KB

File metadata and controls

284 lines (186 loc) · 8.21 KB

\CategoriesAPI

All URIs are relative to https://api.eduframe.nl/api/v1

Method HTTP request Description
CreateCategory Post /categories Create a category.
GetCategories Get /categories Get all category records
GetCategoryById Get /categories/{id} Get a category record
UpdateCategoryById Patch /categories/{id} Update a category.

CreateCategory

Category CreateCategory(ctx).CreateCategoryRequest(createCategoryRequest).Execute()

Create a category.

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID"
)

func main() {
	createCategoryRequest := *openapiclient.NewCreateCategoryRequest("Name_example") // CreateCategoryRequest | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.CategoriesAPI.CreateCategory(context.Background()).CreateCategoryRequest(createCategoryRequest).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CategoriesAPI.CreateCategory``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `CreateCategory`: Category
	fmt.Fprintf(os.Stdout, "Response from `CategoriesAPI.CreateCategory`: %v\n", resp)
}

Path Parameters

Other Parameters

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

Name Type Description Notes
createCategoryRequest CreateCategoryRequest

Return type

Category

Authorization

Bearer

HTTP request headers

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

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

GetCategories

[]Category GetCategories(ctx).Published(published).Sort(sort).Cursor(cursor).PerPage(perPage).Execute()

Get all category records

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID"
)

func main() {
	published := "published_example" // string | Show only published categories (optional)
	sort := []string{"Sort_example"} // []string | Sort the results. Can change order by using `<sort_by>:<direction>` where `<direction>` is either `asc` or `desc` (optional)
	cursor := "cursor_example" // string | **Note**: It's almost never necessary to use this parameter directly, the URL   should be retrieved from the `Link` header.  The cursor used to fetch the next result set.  (optional)
	perPage := int32(10) // int32 | The number of results to retrieve for this page. (optional) (default to 25)

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.CategoriesAPI.GetCategories(context.Background()).Published(published).Sort(sort).Cursor(cursor).PerPage(perPage).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CategoriesAPI.GetCategories``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetCategories`: []Category
	fmt.Fprintf(os.Stdout, "Response from `CategoriesAPI.GetCategories`: %v\n", resp)
}

Path Parameters

Other Parameters

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

Name Type Description Notes
published string Show only published categories
sort []string Sort the results. Can change order by using `<sort_by>:<direction>` where `<direction>` is either `asc` or `desc`
cursor string Note: It's almost never necessary to use this parameter directly, the URL should be retrieved from the `Link` header. The cursor used to fetch the next result set.
perPage int32 The number of results to retrieve for this page. [default to 25]

Return type

[]Category

Authorization

Bearer

HTTP request headers

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

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

GetCategoryById

Category GetCategoryById(ctx, id).Execute()

Get a category record

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID"
)

func main() {
	id := int32(56) // int32 | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.CategoriesAPI.GetCategoryById(context.Background(), id).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CategoriesAPI.GetCategoryById``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetCategoryById`: Category
	fmt.Fprintf(os.Stdout, "Response from `CategoriesAPI.GetCategoryById`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
id int32

Other Parameters

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

Name Type Description Notes

Return type

Category

Authorization

Bearer

HTTP request headers

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

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

UpdateCategoryById

Category UpdateCategoryById(ctx, id).UpdateCategoryByIdRequest(updateCategoryByIdRequest).Execute()

Update a category.

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID"
)

func main() {
	id := int32(56) // int32 | 
	updateCategoryByIdRequest := *openapiclient.NewUpdateCategoryByIdRequest() // UpdateCategoryByIdRequest | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.CategoriesAPI.UpdateCategoryById(context.Background(), id).UpdateCategoryByIdRequest(updateCategoryByIdRequest).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CategoriesAPI.UpdateCategoryById``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `UpdateCategoryById`: Category
	fmt.Fprintf(os.Stdout, "Response from `CategoriesAPI.UpdateCategoryById`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
id int32

Other Parameters

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

Name Type Description Notes

updateCategoryByIdRequest | UpdateCategoryByIdRequest | |

Return type

Category

Authorization

Bearer

HTTP request headers

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

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