code: func NewClient(apiDef *raml.APIDefinition, packageName, rootImportPath, targetDir string,
  	libsRootURLs []string) (Client, error) {
  
  	// rootImportPath only needed if we use libraries
  	if rootImportPath == "" && len(apiDef.Libraries) > 0 {
  		return Client{}, fmt.Errorf("--import-path can't be empty when we use libraries")
  	}
  
  	// TODO : get rid of this global variable
  	rootImportPath = setRootImportPath(rootImportPath, targetDir)
  	globRootImportPath = rootImportPath
  	globAPIDef = apiDef
  	globLibRootURLs = libsRootURLs
  
  	// creates client services objects
  	services := map[string]*ClientService{}
  	for endpoint, res := range apiDef.Resources {
  		rd := resource.New(apiDef, &res, commons.NormalizeURITitle(endpoint), true)
  		services[endpoint] = newClientService(endpoint, packageName, &rd)
  	}
  
  	// creates client object
  	client := Client{
  		apiDef:         apiDef,
  		Name:           commons.NormalizeIdentifier(commons.NormalizeURI(apiDef.Title)),
  		BaseURI:        apiDef.BaseURI,
  		libraries:      apiDef.Libraries,
  		PackageName:    packageName,
  		RootImportPath: rootImportPath,
  		Services:       services,
  		TargetDir:      targetDir,
  		libsRootURLs:   libsRootURLs,
  	}
  
  	if strings.Index(client.BaseURI, "{version}") > 0 {
  		client.BaseURI = strings.Replace(client.BaseURI, "{version}", apiDef.Version, -1)
  	}
  	return client, nil
  }
docs: // NewClient creates a new Golang client