• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang ticketmatic.NewClient函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/ticketmatic/tm-go/ticketmatic.NewClient函数的典型用法代码示例。如果您正苦于以下问题:Golang NewClient函数的具体用法?Golang NewClient怎么用?Golang NewClient使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了NewClient函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: TestGettickets

func TestGettickets(t *testing.T) {
	var err error

	accountcode := os.Getenv("TM_TEST_ACCOUNTCODE")
	accesskey := os.Getenv("TM_TEST_ACCESSKEY")
	secretkey := os.Getenv("TM_TEST_SECRETKEY")
	c := ticketmatic.NewClient(accountcode, accesskey, secretkey)

	list, err := Getlist(c, &ticketmatic.EventQuery{})
	if err != nil {
		t.Fatal(err)
	}

	if len(list.Data) <= 0 {
		t.Errorf("Unexpected list.Data length, got %#v, expected greater than %#v", len(list.Data), 0)
	}

	stream, err := Gettickets(c, list.Data[0].Id, &ticketmatic.EventTicketQuery{})
	if err != nil {
		t.Fatal(err)
	}

	tickets := make([]*ticketmatic.EventTicket, 0)
	for {
		n, err := stream.Next()
		if err != nil {
			t.Fatal(err)
		}
		if n == nil {
			break
		}
		tickets = append(tickets, n)
	}

}
开发者ID:ticketmatic,项目名称:tm-go,代码行数:35,代码来源:operations_test.go


示例2: TestGet

func TestGet(t *testing.T) {
	var err error

	accountcode := os.Getenv("TM_TEST_ACCOUNTCODE")
	accesskey := os.Getenv("TM_TEST_ACCESSKEY")
	secretkey := os.Getenv("TM_TEST_SECRETKEY")
	c := ticketmatic.NewClient(accountcode, accesskey, secretkey)

	req, err := Queries(c, &ticketmatic.QueryRequest{
		Limit: 2,
		Query: "SELECT * FROM tm.paymentscenario",
	})
	if err != nil {
		t.Fatal(err)
	}

	if req.Nbrofresults <= 1 {
		t.Errorf("Unexpected req.Nbrofresults, got %#v, expected > %#v", req.Nbrofresults, 1)
	}

	if len(req.Results) != 2 {
		t.Errorf("Unexpected req.Results length, got %#v, expected %#v", len(req.Results), 2)
	}

}
开发者ID:ticketmatic,项目名称:tm-go,代码行数:25,代码来源:operations_test.go


示例3: TestCreatecodes

func TestCreatecodes(t *testing.T) {
	var err error

	accountcode := os.Getenv("TM_TEST_ACCOUNTCODE")
	accesskey := os.Getenv("TM_TEST_ACCESSKEY")
	secretkey := os.Getenv("TM_TEST_SECRETKEY")
	c := ticketmatic.NewClient(accountcode, accesskey, secretkey)

	codes, err := Createcodes(c, 2, &ticketmatic.AddVoucherCodes{
		Amount: 10,
		Count:  3,
	})
	if err != nil {
		t.Fatal(err)
	}

	if len(codes) != 3 {
		t.Errorf("Unexpected codes length, got %#v, expected %#v", len(codes), 3)
	}

	if codes[0].Code == "" {
		t.Errorf("Unexpected codes[0].Code, got %#v, expected different value", codes[0].Code)
	}

}
开发者ID:ticketmatic,项目名称:tm-go,代码行数:25,代码来源:operations_test.go


示例4: TestGet

func TestGet(t *testing.T) {
	var err error

	accountcode := os.Getenv("TM_TEST_ACCOUNTCODE")
	accesskey := os.Getenv("TM_TEST_ACCESSKEY")
	secretkey := os.Getenv("TM_TEST_SECRETKEY")
	c := ticketmatic.NewClient(accountcode, accesskey, secretkey)

	req, err := Getlist(c)
	if err != nil {
		t.Fatal(err)
	}

	if len(req.Data) <= 0 {
		t.Errorf("Unexpected req.Data length, got %#v, expected greater than %#v", len(req.Data), 0)
	}

	reqget, err := Get(c, req.Data[0].Id)
	if err != nil {
		t.Fatal(err)
	}

	if reqget.Id <= 0 {
		t.Errorf("Unexpected reqget.Id, got %#v, expected > %#v", reqget.Id, 0)
	}

	_, err = Translations(c, reqget.Id)
	if err != nil {
		t.Fatal(err)
	}

}
开发者ID:ticketmatic,项目名称:tm-go,代码行数:32,代码来源:operations_test.go


示例5: TestExport

func TestExport(t *testing.T) {
	var err error

	accountcode := os.Getenv("TM_TEST_ACCOUNTCODE")
	accesskey := os.Getenv("TM_TEST_ACCESSKEY")
	secretkey := os.Getenv("TM_TEST_SECRETKEY")
	c := ticketmatic.NewClient(accountcode, accesskey, secretkey)

	req, err := Export(c, &ticketmatic.QueryRequest{
		Query: "SELECT * FROM tm.contact LIMIT 3",
	})
	if err != nil {
		t.Fatal(err)
	}

	stream := make([]map[string]interface{}, 0)
	for {
		n, err := req.Next()
		if err != nil {
			t.Fatal(err)
		}
		if n == nil {
			break
		}
		stream = append(stream, n)
	}

	if len(stream) != 3 {
		t.Errorf("Unexpected stream length, got %#v, expected %#v", len(stream), 3)
	}

}
开发者ID:ticketmatic,项目名称:tm-go,代码行数:32,代码来源:operations_test.go


示例6: TestCreatequeued

func TestCreatequeued(t *testing.T) {
	var err error

	accountcode := os.Getenv("TM_TEST_ACCOUNTCODE")
	accesskey := os.Getenv("TM_TEST_ACCESSKEY")
	secretkey := os.Getenv("TM_TEST_SECRETKEY")
	c := ticketmatic.NewClient(accountcode, accesskey, secretkey)

	_, err = Create(c, &ticketmatic.CreateOrder{
		Events: []int64{
			777714,
		},
		Saleschannelid: 1,
	})
	var exc *ticketmatic.QueueStatus
	if err != nil {
		if e, ok := err.(*ticketmatic.RateLimitError); ok {
			exc = e.Status
		} else {
			t.Fatal(err)
		}
	}

	if exc == nil {
		t.Fatal("Expected a rate limiting error")
	}

	if exc.Id == "" {
		t.Errorf("Unexpected exc.Id, got %#v, expected different value", exc.Id)
	}

}
开发者ID:ticketmatic,项目名称:tm-go,代码行数:32,代码来源:operations_test.go


示例7: TestGet

func TestGet(t *testing.T) {
	var err error

	accountcode := os.Getenv("TM_TEST_ACCOUNTCODE")
	accesskey := os.Getenv("TM_TEST_ACCESSKEY")
	secretkey := os.Getenv("TM_TEST_SECRETKEY")
	c := ticketmatic.NewClient(accountcode, accesskey, secretkey)

	req, err := Getlist(c, &ticketmatic.PriceTypeQuery{})
	if err != nil {
		t.Fatal(err)
	}

	if len(req.Data) <= 0 {
		t.Errorf("Unexpected req.Data length, got %#v, expected greater than %#v", len(req.Data), 0)
	}

	req2, err := Getlist(c, &ticketmatic.PriceTypeQuery{
		Filter: "select id from conf.pricetype where typeid=2301",
	})
	if err != nil {
		t.Fatal(err)
	}

	if len(req.Data) <= len(req2.Data) {
		t.Errorf("Unexpected req.Data length, got %#v, expected greater than %#v", len(req.Data), len(req2.Data))
	}

}
开发者ID:ticketmatic,项目名称:tm-go,代码行数:29,代码来源:operations_test.go


示例8: TestArchived

func TestArchived(t *testing.T) {
	var err error

	accountcode := os.Getenv("TM_TEST_ACCOUNTCODE")
	accesskey := os.Getenv("TM_TEST_ACCESSKEY")
	secretkey := os.Getenv("TM_TEST_SECRETKEY")
	c := ticketmatic.NewClient(accountcode, accesskey, secretkey)

	contact, err := Create(c, &ticketmatic.Contact{
		Firstname: "John",
	})
	if err != nil {
		t.Fatal(err)
	}

	if contact.Id == 0 {
		t.Errorf("Unexpected contact.Id, got %#v, expected different value", contact.Id)
	}

	if contact.Firstname != "John" {
		t.Errorf("Unexpected contact.Firstname, got %#v, expected %#v", contact.Firstname, "John")
	}

	req, err := Getlist(c, &ticketmatic.ContactQuery{
		Includearchived: true,
	})
	if err != nil {
		t.Fatal(err)
	}

	if len(req.Data) <= 0 {
		t.Errorf("Unexpected req.Data length, got %#v, expected greater than %#v", len(req.Data), 0)
	}

	err = Delete(c, contact.Id)
	if err != nil {
		t.Fatal(err)
	}

	req2, err := Getlist(c, &ticketmatic.ContactQuery{})
	if err != nil {
		t.Fatal(err)
	}

	if len(req.Data) <= len(req2.Data) {
		t.Errorf("Unexpected req.Data length, got %#v, expected greater than %#v", len(req.Data), len(req2.Data))
	}

	req3, err := Getlist(c, &ticketmatic.ContactQuery{
		Includearchived: true,
	})
	if err != nil {
		t.Fatal(err)
	}

	if len(req.Data) != len(req3.Data) {
		t.Errorf("Unexpected req.Data length, got %#v, expected %#v", len(req.Data), len(req3.Data))
	}

}
开发者ID:ticketmatic,项目名称:tm-go,代码行数:60,代码来源:operations_test.go


示例9: TestCreate

func TestCreate(t *testing.T) {
	var err error

	accountcode := os.Getenv("TM_TEST_ACCOUNTCODE")
	accesskey := os.Getenv("TM_TEST_ACCESSKEY")
	secretkey := os.Getenv("TM_TEST_SECRETKEY")
	c := ticketmatic.NewClient(accountcode, accesskey, secretkey)

	event, err := Create(c, &ticketmatic.Event{
		Name: "Example",
		Contingents: []*ticketmatic.EventContingent{
			&ticketmatic.EventContingent{
				Amount: 100,
			},
		},
	})
	if err != nil {
		t.Fatal(err)
	}

	if event.Name != "Example" {
		t.Errorf("Unexpected event.Name, got %#v, expected %#v", event.Name, "Example")
	}

	if event.Contingents[0].Amount != 100 {
		t.Errorf("Unexpected event.Contingents[0].Amount, got %#v, expected %#v", event.Contingents[0].Amount, 100)
	}

}
开发者ID:ticketmatic,项目名称:tm-go,代码行数:29,代码来源:operations_test.go


示例10: TestAddticketsqueued

func TestAddticketsqueued(t *testing.T) {
	var err error

	accountcode := os.Getenv("TM_TEST_ACCOUNTCODE")
	accesskey := os.Getenv("TM_TEST_ACCESSKEY")
	secretkey := os.Getenv("TM_TEST_SECRETKEY")
	c := ticketmatic.NewClient(accountcode, accesskey, secretkey)

	order, err := Create(c, &ticketmatic.CreateOrder{
		Saleschannelid: 1,
	})
	if err != nil {
		t.Fatal(err)
	}

	if order.Orderid == 0 {
		t.Errorf("Unexpected order.Orderid, got %#v, expected different value", order.Orderid)
	}

	if order.Saleschannelid != 1 {
		t.Errorf("Unexpected order.Saleschannelid, got %#v, expected %#v", order.Saleschannelid, 1)
	}

	ttps, err := events.Get(c, 777713)
	if err != nil {
		t.Fatal(err)
	}

	if ttps.Id == 0 {
		t.Errorf("Unexpected ttps.Id, got %#v, expected different value", ttps.Id)
	}

	_, err = Addtickets(c, order.Orderid, &ticketmatic.AddTickets{
		Tickets: []*ticketmatic.CreateTicket{
			&ticketmatic.CreateTicket{
				Tickettypepriceid: ttps.Prices.Contingents[0].Pricetypes[0].Tickettypepriceid,
			},
		},
	})
	var exc *ticketmatic.QueueStatus
	if err != nil {
		if e, ok := err.(*ticketmatic.RateLimitError); ok {
			exc = e.Status
		} else {
			t.Fatal(err)
		}
	}

	if exc == nil {
		t.Fatal("Expected a rate limiting error")
	}

	if exc.Id == "" {
		t.Errorf("Unexpected exc.Id, got %#v, expected different value", exc.Id)
	}

}
开发者ID:ticketmatic,项目名称:tm-go,代码行数:57,代码来源:operations_test.go


示例11: TestCreateunicode

func TestCreateunicode(t *testing.T) {
	var err error

	accountcode := os.Getenv("TM_TEST_ACCOUNTCODE")
	accesskey := os.Getenv("TM_TEST_ACCESSKEY")
	secretkey := os.Getenv("TM_TEST_SECRETKEY")
	c := ticketmatic.NewClient(accountcode, accesskey, secretkey)

	contact, err := Create(c, &ticketmatic.Contact{
		Firstname: "JØhñ",
		Lastname:  "ポテト  

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang ticketmatic.Client类代码示例发布时间:2022-05-28
下一篇:
Golang gin.Context类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap