1 Star 0 Fork 41

naibahq/go-gitee

forked from openEuler/go-gitee 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
api_enterprises.go 59.24 KB
一键复制 编辑 原始数据 按行查看 历史
xiangxinyong 提交于 2019-09-25 18:05 . Fix format&imports error
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603
/*
* 码云 Open API
*
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* API version: 5.3.2
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package gitee
import (
"context"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"strings"
"github.com/antihax/optional"
)
// Linger please
var (
_ context.Context
)
type EnterprisesApiService service
/*
EnterprisesApiService 移除企业成员
移除企业成员
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param enterprise 企业的路径(path/login)
* @param username 用户名(username/login)
* @param optional nil or *DeleteV5EnterprisesEnterpriseMembersUsernameOpts - Optional Parameters:
* @param "AccessToken" (optional.String) - 用户授权码
*/
type DeleteV5EnterprisesEnterpriseMembersUsernameOpts struct {
AccessToken optional.String
}
func (a *EnterprisesApiService) DeleteV5EnterprisesEnterpriseMembersUsername(ctx context.Context, enterprise string, username string, localVarOptionals *DeleteV5EnterprisesEnterpriseMembersUsernameOpts) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Delete")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/v5/enterprises/{enterprise}/members/{username}"
localVarPath = strings.Replace(localVarPath, "{"+"enterprise"+"}", fmt.Sprintf("%v", enterprise), -1)
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.AccessToken.IsSet() {
localVarQueryParams.Add("access_token", parameterToString(localVarOptionals.AccessToken.Value(), ""))
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"application/json", "multipart/form-data"}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarHttpResponse, err
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
body: localVarBody,
error: localVarHttpResponse.Status,
}
return localVarHttpResponse, newErr
}
return localVarHttpResponse, nil
}
/*
EnterprisesApiService 删除周报某个评论
删除周报某个评论
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param enterprise 企业的路径(path/login)
* @param reportId 周报ID
* @param id 评论ID
* @param optional nil or *DeleteV5EnterprisesEnterpriseWeekReportsReportIdCommentsIdOpts - Optional Parameters:
* @param "AccessToken" (optional.String) - 用户授权码
*/
type DeleteV5EnterprisesEnterpriseWeekReportsReportIdCommentsIdOpts struct {
AccessToken optional.String
}
func (a *EnterprisesApiService) DeleteV5EnterprisesEnterpriseWeekReportsReportIdCommentsId(ctx context.Context, enterprise string, reportId int32, id int32, localVarOptionals *DeleteV5EnterprisesEnterpriseWeekReportsReportIdCommentsIdOpts) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Delete")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/v5/enterprises/{enterprise}/week_reports/{report_id}/comments/{id}"
localVarPath = strings.Replace(localVarPath, "{"+"enterprise"+"}", fmt.Sprintf("%v", enterprise), -1)
localVarPath = strings.Replace(localVarPath, "{"+"report_id"+"}", fmt.Sprintf("%v", reportId), -1)
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.AccessToken.IsSet() {
localVarQueryParams.Add("access_token", parameterToString(localVarOptionals.AccessToken.Value(), ""))
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"application/json", "multipart/form-data"}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarHttpResponse, err
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
body: localVarBody,
error: localVarHttpResponse.Status,
}
return localVarHttpResponse, newErr
}
return localVarHttpResponse, nil
}
/*
EnterprisesApiService 获取一个企业
获取一个企业
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param enterprise 企业的路径(path/login)
* @param optional nil or *GetV5EnterprisesEnterpriseOpts - Optional Parameters:
* @param "AccessToken" (optional.String) - 用户授权码
@return EnterpriseBasic
*/
type GetV5EnterprisesEnterpriseOpts struct {
AccessToken optional.String
}
func (a *EnterprisesApiService) GetV5EnterprisesEnterprise(ctx context.Context, enterprise string, localVarOptionals *GetV5EnterprisesEnterpriseOpts) (EnterpriseBasic, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue EnterpriseBasic
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/v5/enterprises/{enterprise}"
localVarPath = strings.Replace(localVarPath, "{"+"enterprise"+"}", fmt.Sprintf("%v", enterprise), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.AccessToken.IsSet() {
localVarQueryParams.Add("access_token", parameterToString(localVarOptionals.AccessToken.Value(), ""))
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"application/json", "multipart/form-data"}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
body: localVarBody,
error: localVarHttpResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v EnterpriseBasic
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
}
/*
EnterprisesApiService 列出企业的所有成员
列出企业的所有成员
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param enterprise 企业的路径(path/login)
* @param optional nil or *GetV5EnterprisesEnterpriseMembersOpts - Optional Parameters:
* @param "AccessToken" (optional.String) - 用户授权码
* @param "Role" (optional.String) - 根据角色筛选成员
@return []EnterpriseMember
*/
type GetV5EnterprisesEnterpriseMembersOpts struct {
AccessToken optional.String
Role optional.String
}
func (a *EnterprisesApiService) GetV5EnterprisesEnterpriseMembers(ctx context.Context, enterprise string, localVarOptionals *GetV5EnterprisesEnterpriseMembersOpts) ([]EnterpriseMember, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue []EnterpriseMember
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/v5/enterprises/{enterprise}/members"
localVarPath = strings.Replace(localVarPath, "{"+"enterprise"+"}", fmt.Sprintf("%v", enterprise), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.AccessToken.IsSet() {
localVarQueryParams.Add("access_token", parameterToString(localVarOptionals.AccessToken.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.Role.IsSet() {
localVarQueryParams.Add("role", parameterToString(localVarOptionals.Role.Value(), ""))
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"application/json", "multipart/form-data"}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
body: localVarBody,
error: localVarHttpResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v []EnterpriseMember
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
}
/*
EnterprisesApiService 获取企业的一个成员
获取企业的一个成员
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param enterprise 企业的路径(path/login)
* @param username 用户名(username/login)
* @param optional nil or *GetV5EnterprisesEnterpriseMembersUsernameOpts - Optional Parameters:
* @param "AccessToken" (optional.String) - 用户授权码
@return EnterpriseMember
*/
type GetV5EnterprisesEnterpriseMembersUsernameOpts struct {
AccessToken optional.String
}
func (a *EnterprisesApiService) GetV5EnterprisesEnterpriseMembersUsername(ctx context.Context, enterprise string, username string, localVarOptionals *GetV5EnterprisesEnterpriseMembersUsernameOpts) (EnterpriseMember, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue EnterpriseMember
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/v5/enterprises/{enterprise}/members/{username}"
localVarPath = strings.Replace(localVarPath, "{"+"enterprise"+"}", fmt.Sprintf("%v", enterprise), -1)
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.AccessToken.IsSet() {
localVarQueryParams.Add("access_token", parameterToString(localVarOptionals.AccessToken.Value(), ""))
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"application/json", "multipart/form-data"}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
body: localVarBody,
error: localVarHttpResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v EnterpriseMember
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
}
/*
EnterprisesApiService 个人周报列表
个人周报列表
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param enterprise 企业的路径(path/login)
* @param username 用户名(username/login)
* @param optional nil or *GetV5EnterprisesEnterpriseUsersUsernameWeekReportsOpts - Optional Parameters:
* @param "AccessToken" (optional.String) - 用户授权码
* @param "Page" (optional.Int32) - 当前的页码
* @param "PerPage" (optional.Int32) - 每页的数量,最大为 100
@return []WeekReport
*/
type GetV5EnterprisesEnterpriseUsersUsernameWeekReportsOpts struct {
AccessToken optional.String
Page optional.Int32
PerPage optional.Int32
}
func (a *EnterprisesApiService) GetV5EnterprisesEnterpriseUsersUsernameWeekReports(ctx context.Context, enterprise string, username string, localVarOptionals *GetV5EnterprisesEnterpriseUsersUsernameWeekReportsOpts) ([]WeekReport, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue []WeekReport
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/v5/enterprises/{enterprise}/users/{username}/week_reports"
localVarPath = strings.Replace(localVarPath, "{"+"enterprise"+"}", fmt.Sprintf("%v", enterprise), -1)
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.AccessToken.IsSet() {
localVarQueryParams.Add("access_token", parameterToString(localVarOptionals.AccessToken.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.Page.IsSet() {
localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.PerPage.IsSet() {
localVarQueryParams.Add("per_page", parameterToString(localVarOptionals.PerPage.Value(), ""))
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"application/json", "multipart/form-data"}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
body: localVarBody,
error: localVarHttpResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v []WeekReport
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
}
/*
EnterprisesApiService 企业成员周报列表
企业成员周报列表
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param enterprise 企业的路径(path/login)
* @param optional nil or *GetV5EnterprisesEnterpriseWeekReportsOpts - Optional Parameters:
* @param "AccessToken" (optional.String) - 用户授权码
* @param "Page" (optional.Int32) - 当前的页码
* @param "PerPage" (optional.Int32) - 每页的数量,最大为 100
* @param "Username" (optional.String) - 用户名(username/login)
* @param "Year" (optional.Int32) - 周报所属年
* @param "WeekIndex" (optional.Int32) - 周报所属周
* @param "Date" (optional.String) - 周报日期(格式:2019-03-25)
@return []WeekReport
*/
type GetV5EnterprisesEnterpriseWeekReportsOpts struct {
AccessToken optional.String
Page optional.Int32
PerPage optional.Int32
Username optional.String
Year optional.Int32
WeekIndex optional.Int32
Date optional.String
}
func (a *EnterprisesApiService) GetV5EnterprisesEnterpriseWeekReports(ctx context.Context, enterprise string, localVarOptionals *GetV5EnterprisesEnterpriseWeekReportsOpts) ([]WeekReport, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue []WeekReport
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/v5/enterprises/{enterprise}/week_reports"
localVarPath = strings.Replace(localVarPath, "{"+"enterprise"+"}", fmt.Sprintf("%v", enterprise), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.AccessToken.IsSet() {
localVarQueryParams.Add("access_token", parameterToString(localVarOptionals.AccessToken.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.Page.IsSet() {
localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.PerPage.IsSet() {
localVarQueryParams.Add("per_page", parameterToString(localVarOptionals.PerPage.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.Username.IsSet() {
localVarQueryParams.Add("username", parameterToString(localVarOptionals.Username.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.Year.IsSet() {
localVarQueryParams.Add("year", parameterToString(localVarOptionals.Year.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.WeekIndex.IsSet() {
localVarQueryParams.Add("week_index", parameterToString(localVarOptionals.WeekIndex.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.Date.IsSet() {
localVarQueryParams.Add("date", parameterToString(localVarOptionals.Date.Value(), ""))
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"application/json", "multipart/form-data"}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
body: localVarBody,
error: localVarHttpResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v []WeekReport
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
}
/*
EnterprisesApiService 周报详情
周报详情
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param enterprise 企业的路径(path/login)
* @param id 周报ID
* @param optional nil or *GetV5EnterprisesEnterpriseWeekReportsIdOpts - Optional Parameters:
* @param "AccessToken" (optional.String) - 用户授权码
@return WeekReport
*/
type GetV5EnterprisesEnterpriseWeekReportsIdOpts struct {
AccessToken optional.String
}
func (a *EnterprisesApiService) GetV5EnterprisesEnterpriseWeekReportsId(ctx context.Context, enterprise string, id int32, localVarOptionals *GetV5EnterprisesEnterpriseWeekReportsIdOpts) (WeekReport, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue WeekReport
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/v5/enterprises/{enterprise}/week_reports/{id}"
localVarPath = strings.Replace(localVarPath, "{"+"enterprise"+"}", fmt.Sprintf("%v", enterprise), -1)
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.AccessToken.IsSet() {
localVarQueryParams.Add("access_token", parameterToString(localVarOptionals.AccessToken.Value(), ""))
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"application/json", "multipart/form-data"}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
body: localVarBody,
error: localVarHttpResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v WeekReport
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
}
/*
EnterprisesApiService 某个周报评论列表
某个周报评论列表
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param enterprise 企业的路径(path/login)
* @param id 周报ID
* @param optional nil or *GetV5EnterprisesEnterpriseWeekReportsIdCommentsOpts - Optional Parameters:
* @param "AccessToken" (optional.String) - 用户授权码
* @param "Page" (optional.Int32) - 当前的页码
* @param "PerPage" (optional.Int32) - 每页的数量,最大为 100
@return []Note
*/
type GetV5EnterprisesEnterpriseWeekReportsIdCommentsOpts struct {
AccessToken optional.String
Page optional.Int32
PerPage optional.Int32
}
func (a *EnterprisesApiService) GetV5EnterprisesEnterpriseWeekReportsIdComments(ctx context.Context, enterprise string, id int32, localVarOptionals *GetV5EnterprisesEnterpriseWeekReportsIdCommentsOpts) ([]Note, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue []Note
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/v5/enterprises/{enterprise}/week_reports/{id}/comments"
localVarPath = strings.Replace(localVarPath, "{"+"enterprise"+"}", fmt.Sprintf("%v", enterprise), -1)
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.AccessToken.IsSet() {
localVarQueryParams.Add("access_token", parameterToString(localVarOptionals.AccessToken.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.Page.IsSet() {
localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.PerPage.IsSet() {
localVarQueryParams.Add("per_page", parameterToString(localVarOptionals.PerPage.Value(), ""))
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"application/json", "multipart/form-data"}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
body: localVarBody,
error: localVarHttpResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v []Note
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
}
/*
EnterprisesApiService 列出授权用户所属的企业
列出授权用户所属的企业
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param optional nil or *GetV5UserEnterprisesOpts - Optional Parameters:
* @param "AccessToken" (optional.String) - 用户授权码
* @param "Page" (optional.Int32) - 当前的页码
* @param "PerPage" (optional.Int32) - 每页的数量,最大为 100
* @param "Admin" (optional.Bool) - 只列出授权用户管理的企业
@return []EnterpriseBasic
*/
type GetV5UserEnterprisesOpts struct {
AccessToken optional.String
Page optional.Int32
PerPage optional.Int32
Admin optional.Bool
}
func (a *EnterprisesApiService) GetV5UserEnterprises(ctx context.Context, localVarOptionals *GetV5UserEnterprisesOpts) ([]EnterpriseBasic, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue []EnterpriseBasic
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/v5/user/enterprises"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.AccessToken.IsSet() {
localVarQueryParams.Add("access_token", parameterToString(localVarOptionals.AccessToken.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.Page.IsSet() {
localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.PerPage.IsSet() {
localVarQueryParams.Add("per_page", parameterToString(localVarOptionals.PerPage.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.Admin.IsSet() {
localVarQueryParams.Add("admin", parameterToString(localVarOptionals.Admin.Value(), ""))
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"application/json", "multipart/form-data"}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
body: localVarBody,
error: localVarHttpResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v []EnterpriseBasic
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
}
/*
EnterprisesApiService 编辑周报
编辑周报
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param enterprise 企业的路径(path/login)
* @param id 周报ID
* @param content 周报内容
* @param optional nil or *PatchV5EnterprisesEnterpriseWeekReportIdOpts - Optional Parameters:
* @param "AccessToken" (optional.String) - 用户授权码
@return WeekReport
*/
type PatchV5EnterprisesEnterpriseWeekReportIdOpts struct {
AccessToken optional.String
}
func (a *EnterprisesApiService) PatchV5EnterprisesEnterpriseWeekReportId(ctx context.Context, enterprise string, id int32, content string, localVarOptionals *PatchV5EnterprisesEnterpriseWeekReportIdOpts) (WeekReport, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Patch")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue WeekReport
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/v5/enterprises/{enterprise}/week_report/{id}"
localVarPath = strings.Replace(localVarPath, "{"+"enterprise"+"}", fmt.Sprintf("%v", enterprise), -1)
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"application/json", "multipart/form-data"}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
if localVarOptionals != nil && localVarOptionals.AccessToken.IsSet() {
localVarFormParams.Add("access_token", parameterToString(localVarOptionals.AccessToken.Value(), ""))
}
localVarFormParams.Add("content", parameterToString(content, ""))
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
body: localVarBody,
error: localVarHttpResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v WeekReport
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
}
/*
EnterprisesApiService 添加或邀请企业成员
添加或邀请企业成员
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param enterprise 企业的路径(path/login)
* @param optional nil or *PostV5EnterprisesEnterpriseMembersOpts - Optional Parameters:
* @param "AccessToken" (optional.String) - 用户授权码
* @param "Username" (optional.String) - 需要邀请的码云用户名(username/login),username,email至少填写一个
* @param "Email" (optional.String) - 要添加邮箱地址,若该邮箱未注册则自动创建帐号。username,email至少填写一个
* @param "Outsourced" (optional.Bool) - 是否企业外包成员,默认:否
* @param "Role" (optional.String) - 企业角色,默认普通成员
* @param "Name" (optional.String) - 企业成员真实姓名(备注)
*/
type PostV5EnterprisesEnterpriseMembersOpts struct {
AccessToken optional.String
Username optional.String
Email optional.String
Outsourced optional.Bool
Role optional.String
Name optional.String
}
func (a *EnterprisesApiService) PostV5EnterprisesEnterpriseMembers(ctx context.Context, enterprise string, localVarOptionals *PostV5EnterprisesEnterpriseMembersOpts) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/v5/enterprises/{enterprise}/members"
localVarPath = strings.Replace(localVarPath, "{"+"enterprise"+"}", fmt.Sprintf("%v", enterprise), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"application/json", "multipart/form-data"}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
if localVarOptionals != nil && localVarOptionals.AccessToken.IsSet() {
localVarFormParams.Add("access_token", parameterToString(localVarOptionals.AccessToken.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.Username.IsSet() {
localVarFormParams.Add("username", parameterToString(localVarOptionals.Username.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.Email.IsSet() {
localVarFormParams.Add("email", parameterToString(localVarOptionals.Email.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.Outsourced.IsSet() {
localVarFormParams.Add("outsourced", parameterToString(localVarOptionals.Outsourced.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.Role.IsSet() {
localVarFormParams.Add("role", parameterToString(localVarOptionals.Role.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.Name.IsSet() {
localVarFormParams.Add("name", parameterToString(localVarOptionals.Name.Value(), ""))
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarHttpResponse, err
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
body: localVarBody,
error: localVarHttpResponse.Status,
}
return localVarHttpResponse, newErr
}
return localVarHttpResponse, nil
}
/*
EnterprisesApiService 新建周报
新建周报
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param enterprise 企业的路径(path/login)
* @param year 周报所属年
* @param content 周报内容
* @param weekIndex 周报所属周
* @param username 用户名(username/login)
* @param optional nil or *PostV5EnterprisesEnterpriseWeekReportOpts - Optional Parameters:
* @param "AccessToken" (optional.String) - 用户授权码
* @param "Date" (optional.String) - 周报日期(格式:2019-03-25)
@return WeekReport
*/
type PostV5EnterprisesEnterpriseWeekReportOpts struct {
AccessToken optional.String
Date optional.String
}
func (a *EnterprisesApiService) PostV5EnterprisesEnterpriseWeekReport(ctx context.Context, enterprise string, year int32, content string, weekIndex int32, username string, localVarOptionals *PostV5EnterprisesEnterpriseWeekReportOpts) (WeekReport, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue WeekReport
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/v5/enterprises/{enterprise}/week_report"
localVarPath = strings.Replace(localVarPath, "{"+"enterprise"+"}", fmt.Sprintf("%v", enterprise), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"application/json", "multipart/form-data"}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
if localVarOptionals != nil && localVarOptionals.AccessToken.IsSet() {
localVarFormParams.Add("access_token", parameterToString(localVarOptionals.AccessToken.Value(), ""))
}
localVarFormParams.Add("year", parameterToString(year, ""))
localVarFormParams.Add("content", parameterToString(content, ""))
localVarFormParams.Add("week_index", parameterToString(weekIndex, ""))
localVarFormParams.Add("username", parameterToString(username, ""))
if localVarOptionals != nil && localVarOptionals.Date.IsSet() {
localVarFormParams.Add("date", parameterToString(localVarOptionals.Date.Value(), ""))
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
body: localVarBody,
error: localVarHttpResponse.Status,
}
if localVarHttpResponse.StatusCode == 201 {
var v WeekReport
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
}
/*
EnterprisesApiService 评论周报
评论周报
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param enterprise 企业的路径(path/login)
* @param id 周报ID
* @param body 评论的内容
* @param optional nil or *PostV5EnterprisesEnterpriseWeekReportsIdCommentOpts - Optional Parameters:
* @param "AccessToken" (optional.String) - 用户授权码
@return Note
*/
type PostV5EnterprisesEnterpriseWeekReportsIdCommentOpts struct {
AccessToken optional.String
}
func (a *EnterprisesApiService) PostV5EnterprisesEnterpriseWeekReportsIdComment(ctx context.Context, enterprise string, id int32, body string, localVarOptionals *PostV5EnterprisesEnterpriseWeekReportsIdCommentOpts) (Note, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue Note
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/v5/enterprises/{enterprise}/week_reports/{id}/comment"
localVarPath = strings.Replace(localVarPath, "{"+"enterprise"+"}", fmt.Sprintf("%v", enterprise), -1)
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"application/json", "multipart/form-data"}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
if localVarOptionals != nil && localVarOptionals.AccessToken.IsSet() {
localVarFormParams.Add("access_token", parameterToString(localVarOptionals.AccessToken.Value(), ""))
}
localVarFormParams.Add("body", parameterToString(body, ""))
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
body: localVarBody,
error: localVarHttpResponse.Status,
}
if localVarHttpResponse.StatusCode == 201 {
var v Note
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
}
/*
EnterprisesApiService 修改企业成员权限或备注
修改企业成员权限或备注
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param enterprise 企业的路径(path/login)
* @param username 用户名(username/login)
* @param optional nil or *PutV5EnterprisesEnterpriseMembersUsernameOpts - Optional Parameters:
* @param "AccessToken" (optional.String) - 用户授权码
* @param "Outsourced" (optional.Bool) - 是否企业外包成员,默认:否
* @param "Role" (optional.String) - 企业角色,默认普通成员
* @param "Active" (optional.Bool) - 是否可访问企业资源,默认:是。(若选否则禁止该用户访问企业资源)
* @param "Name" (optional.String) - 企业成员真实姓名(备注)
@return EnterpriseMember
*/
type PutV5EnterprisesEnterpriseMembersUsernameOpts struct {
AccessToken optional.String
Outsourced optional.Bool
Role optional.String
Active optional.Bool
Name optional.String
}
func (a *EnterprisesApiService) PutV5EnterprisesEnterpriseMembersUsername(ctx context.Context, enterprise string, username string, localVarOptionals *PutV5EnterprisesEnterpriseMembersUsernameOpts) (EnterpriseMember, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Put")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue EnterpriseMember
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/v5/enterprises/{enterprise}/members/{username}"
localVarPath = strings.Replace(localVarPath, "{"+"enterprise"+"}", fmt.Sprintf("%v", enterprise), -1)
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"application/json", "multipart/form-data"}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
if localVarOptionals != nil && localVarOptionals.AccessToken.IsSet() {
localVarFormParams.Add("access_token", parameterToString(localVarOptionals.AccessToken.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.Outsourced.IsSet() {
localVarFormParams.Add("outsourced", parameterToString(localVarOptionals.Outsourced.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.Role.IsSet() {
localVarFormParams.Add("role", parameterToString(localVarOptionals.Role.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.Active.IsSet() {
localVarFormParams.Add("active", parameterToString(localVarOptionals.Active.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.Name.IsSet() {
localVarFormParams.Add("name", parameterToString(localVarOptionals.Name.Value(), ""))
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
body: localVarBody,
error: localVarHttpResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v EnterpriseMember
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/naibahq/go-gitee.git
git@gitee.com:naibahq/go-gitee.git
naibahq
go-gitee
go-gitee
bc992e4c5b2c

搜索帮助