You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-scm/scm/driver/harness/org.go

58 lines
1.2 KiB
Go

// Copyright 2017 Drone.IO Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package harness
import (
"context"
"git.awesome-for.me/liuzhiguo/go-scm/scm"
)
type organizationService struct {
client *wrapper
}
func (s *organizationService) Find(ctx context.Context, name string) (*scm.Organization, *scm.Response, error) {
return nil, nil, scm.ErrNotSupported
}
func (s *organizationService) FindMembership(ctx context.Context, name, username string) (*scm.Membership, *scm.Response, error) {
return nil, nil, scm.ErrNotSupported
}
func (s *organizationService) List(ctx context.Context, opts scm.ListOptions) ([]*scm.Organization, *scm.Response, error) {
return nil, nil, scm.ErrNotSupported
}
//
// native data structures
//
type org struct {
Name string `json:"username"`
Avatar string `json:"avatar_url"`
}
//
// native data structure conversion
//
func convertOrgList(from []*org) []*scm.Organization {
to := []*scm.Organization{}
for _, v := range from {
to = append(to, convertOrg(v))
}
return to
}
func convertOrg(from *org) *scm.Organization {
return &scm.Organization{
Name: from.Name,
Avatar: from.Avatar,
}
}