package
0.0.0-20241107225852-559ac656df31
Repository: https://github.com/traptitech/anke-to.git
Documentation: pkg.go.dev

# README

Go API client for openapi

anke-to API

Overview

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

  • API version: 1.0.0-oas3
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit https://github.com/traPtitech/anke-to

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context
go get github.com/antihax/optional

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

import "./openapi"

Documentation for API Endpoints

All URIs are relative to https://anke-to.trap.jp/api

ClassMethodHTTP requestDescription
GroupApiGetGroupsGet /groups未実装
QuestionApiDeleteQuestionDelete /questions/{questionID}
QuestionApiPatchQuestionPatch /questions/{questionID}
QuestionApiPostQuestionPost /questions
QuestionnaireApiDelteQuestionnaireDelete /questionnaires/{questionnaireID}
QuestionnaireApiGetQuestionnaireGet /questionnaires/{questionnaireID}
QuestionnaireApiGetQuestionnairesGet /questionnaires
QuestionnaireApiGetQuestionsGet /questionnaires/{questionnaireID}/questions
QuestionnaireApiPatchQuestionnairePatch /questionnaires/{questionnaireID}
QuestionnaireApiPostQuestionnairePost /questionnaires
ResponseApiDeleteResponseDelete /responses/{responseID}
ResponseApiGetResponsesGet /responses/{responseID}
ResponseApiPatchResponsePatch /responses/{responseID}
ResponseApiPostResponsePost /responses
ResultApiGetResultsGet /results/{questionnaireID}
UserApiGetMeGet /users/me
UserApiGetMyAdministratesGet /users/me/administrates
UserApiGetMyResponsesGet /users/me/responses
UserApiGetMyTargetedGet /users/me/targeted
UserApiGetResponsesToQuestionnaireGet /users/me/responses/{questionnaireID}
UserApiGetUsersGet /users未実装

Documentation For Models

Documentation For Authorization

application

  • Type: OAuth
  • Flow: application
  • Authorization URL:
  • Scopes:
  • write: allows modifying resources
  • read: allows reading resources

Example

auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
r, err := client.Service.Operation(auth, args)

Or via OAuth2 module to automatically refresh tokens and perform user authentication.

import "golang.org/x/oauth2"

/* Perform OAuth2 round trip request and obtain a token */

tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource)
r, err := client.Service.Operation(auth, args)

Author

# Functions

CacheExpires helper function to determine remaining time before repeating a request.
NewAPIClient creates a new API client.
NewAPIResponse returns a new APIResonse object.
NewAPIResponseWithError returns a new APIResponse object with the provided error message.
NewConfiguration returns a new Configuration object.

# Variables

ContextAccessToken takes a string oauth2 access token as authentication for the request.
ContextAPIKey takes an APIKey as authentication for the request.
ContextBasicAuth takes BasicAuth as authentication for the request.
ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.

# Structs

APIClient manages communication with the anke-to API API v1.0.0-oas3 In most cases there should be only one, shared, APIClient.
APIKey provides API key based authentication to a request passed via context using ContextAPIKey.
APIResponse stores the API response returned by the server.
BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth.
Configuration stores the configuration of the API client.
GenericOpenAPIError Provides access to the body, error and model on returned errors.
Group struct for Group.
Me struct for Me.
NewQuestion struct for NewQuestion.
NewQuestionnaire struct for NewQuestionnaire.
NewQuestionnaireResponse struct for NewQuestionnaireResponse.
NewResponse struct for NewResponse.
Question struct for Question.
QuestionAllOf struct for QuestionAllOf.
QuestionDetails struct for QuestionDetails.
QuestionDetailsAllOf struct for QuestionDetailsAllOf.
Questionnaire struct for Questionnaire.
QuestionnaireById struct for QuestionnaireById.
QuestionnaireByIdAllOf struct for QuestionnaireByIdAllOf.
QuestionnaireForList struct for QuestionnaireForList.
QuestionnaireForListAllOf struct for QuestionnaireForListAllOf.
QuestionnaireMyAdministrates struct for QuestionnaireMyAdministrates.
QuestionnaireMyAdministratesAllOf struct for QuestionnaireMyAdministratesAllOf.
QuestionnaireMyTargeted struct for QuestionnaireMyTargeted.
QuestionnaireMyTargetedAllOf struct for QuestionnaireMyTargetedAllOf.
QuestionnaireUser struct for QuestionnaireUser.
QuestionnaireUserAllOf struct for QuestionnaireUserAllOf.
Response struct for Response.
ResponseAllOf struct for ResponseAllOf.
ResponseBody struct for ResponseBody.
ResponseDetails struct for ResponseDetails.
ResponseDetailsAllOf struct for ResponseDetailsAllOf.
ResponseResult struct for ResponseResult.
ResponseResultAllOf struct for ResponseResultAllOf.
ResponseSummary struct for ResponseSummary.
ServerConfiguration stores the information about a server.
ServerVariable stores the information about a server variable.
User struct for User.

# Type aliases

GroupApiService GroupApi service.
QuestionApiService QuestionApi service.
QuestionnaireApiService QuestionnaireApi service.
ResponseApiService ResponseApi service.
ResultApiService ResultApi service.
UserApiService UserApi service.