Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: rename package name #15

Merged
merged 1 commit into from
Jun 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# Dada Logistics Open Platform SDK For Golang Language

[![Go Report Card](https://goreportcard.com/badge/github.com/houseme/imdada-go)](https://goreportcard.com/report/github.com/houseme/imdada-go)
[![Go Reference](https://pkg.go.dev/badge/github.com/houseme/imdada-go.svg)](https://pkg.go.dev/github.com/houseme/imdada-go)
[![ImDada-CI](https://github.com/houseme/imdada-go/actions/workflows/go.yml/badge.svg)](https://github.com/houseme/imdada-go/actions/workflows/go.yml)
![GitHub](https://img.shields.io/github/license/houseme/imdada-go?style=flat-square)
![GitHub go.mod Go version (branch)](https://img.shields.io/github/go-mod/go-version/houseme/imdada-go/main?style=flat-square)
[![Go Report Card](https://goreportcard.com/badge/github.com/houseme/imdadago)](https://goreportcard.com/report/github.com/houseme/imdadago)
[![Go Reference](https://pkg.go.dev/badge/github.com/houseme/imdadago.svg)](https://pkg.go.dev/github.com/houseme/imdadago)
[![ImDada-CI](https://github.com/houseme/imdadago/actions/workflows/go.yml/badge.svg)](https://github.com/houseme/imdadago/actions/workflows/go.yml)
![GitHub](https://img.shields.io/github/license/houseme/imdadago?style=flat-square)
![GitHub go.mod Go version (branch)](https://img.shields.io/github/go-mod/go-version/houseme/imdadago/main?style=flat-square)

Dada logistics information service open platform SDK for Golang language.
Help you save costs and achieve efficient distribution

## Installation

```bash
go get -u -v github.com/houseme/imdada-go@main
go get -u -v github.com/houseme/imdadago@main
```

## Usage
Expand All @@ -24,12 +24,12 @@ import (
"context"
"fmt"

"github.com/houseme/imdada-go"
"github.com/houseme/imdadago"
)

func main() {
ctx := context.Background()
d := dada.New(ctx, dada.WithAppKey("xxxxx"), dada.WithAppSecret("xxxxx"))
d := dadago.New(ctx, dada.WithAppKey("xxxxx"), dada.WithAppSecret("xxxxx"))

fmt.Println("Dada:", d)
}
Expand Down
6 changes: 3 additions & 3 deletions constant.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright `IMDaDa-Go` Author(https://houseme.github.io/imdada-go/). All Rights Reserved.
* Copyright `IMDaDaGo` Author(https://houseme.github.io/imdadago/). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* You can obtain one at https://github.com/houseme/imdada-go.
* You can obtain one at https://github.com/houseme/imdadago.
*/

package dada
package dadago

const (
// version is the default version of ImDada.
Expand Down
21 changes: 21 additions & 0 deletions doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright `IMDaDaGo` Author(https://houseme.github.io/imdadago/). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* You can obtain one at https://github.com/houseme/imdadago.
*
*/

// Package dadago is the ImDaDa-go client.
package dadago
139 changes: 139 additions & 0 deletions domain.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
/*
* Copyright `IMDaDaGo` Author(https://houseme.github.io/imdadago/). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* You can obtain one at https://github.com/houseme/imdadago.
*
*/

package dadago

import (
"time"

"github.com/cloudwego/hertz/pkg/common/hlog"
"github.com/cloudwego/hertz/pkg/protocol"

"github.com/houseme/imdadago/domain"
)

// Level is the log level.
type Level hlog.Level

// Logger is the logger.
type Logger hlog.FullLogger

// options is the configuration for the ImDada client.
type options struct {
AppKey string
AppSecret string
SourceID string
Gateway string
Callback string
ShopNo string
LogPath string // 日志路径
Level Level // 日志级别
TimeOut time.Duration
UserAgent []byte
Debug bool
}

// Option the option is an ImDada option.
type Option func(o *options)

// WithAppKey sets the app key.
func WithAppKey(appKey string) Option {
return func(o *options) {
o.AppKey = appKey
}
}

// WithAppSecret sets the app secret.
func WithAppSecret(appSecret string) Option {
return func(o *options) {
o.AppSecret = appSecret
}
}

// WithSourceID sets the source id.
func WithSourceID(sourceID string) Option {
return func(o *options) {
o.SourceID = sourceID
}
}

// WithGateway sets the gateway.
func WithGateway(gateway string) Option {
return func(o *options) {
o.Gateway = gateway
}
}

// WithTimeOut sets the timeout.
func WithTimeOut(timeout time.Duration) Option {
return func(o *options) {
o.TimeOut = timeout
}
}

// WithUserAgent sets the user agent.
func WithUserAgent(userAgent []byte) Option {
return func(o *options) {
o.UserAgent = userAgent
}
}

// WithDebug sets the debug.
func WithDebug(debug bool) Option {
return func(o *options) {
o.Debug = debug
}
}

// WithCallback sets the callback.
func WithCallback(callback string) Option {
return func(o *options) {
o.Callback = callback
}
}

// WithShopNo sets the shop no.
func WithShopNo(shopNo string) Option {
return func(o *options) {
o.ShopNo = shopNo
}
}

// WithLogPath sets the log path.
func WithLogPath(logPath string) Option {
return func(o *options) {
o.LogPath = logPath
}
}

// WithLevel sets the log level.
func WithLevel(level Level) Option {
return func(o *options) {
o.Level = level
}
}

// Client is the ImDada client.
type Client struct {
request *domain.Request
response *protocol.Response
log Logger
op options
gateway string
}
21 changes: 21 additions & 0 deletions domain/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright `IMDaDaGo` Author(https://houseme.github.io/imdadago/). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* You can obtain one at https://github.com/houseme/imdadago.
*
*/

// Package domain is the ImDaDaGo client.
package domain
4 changes: 2 additions & 2 deletions domain/imdada.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright `IMDaDa-Go` Author(https://houseme.github.io/imdada-go/). All Rights Reserved.
* Copyright `IMDaDaGo` Author(https://houseme.github.io/imdadago/). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* You can obtain one at https://github.com/houseme/imdada-go.
* You can obtain one at https://github.com/houseme/imdadago.
*/

// Package domain is the domain of ImDaDa.
Expand Down
4 changes: 2 additions & 2 deletions domain/merchant.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright `IMDaDa-Go` Author(https://houseme.github.io/imdada-go/). All Rights Reserved.
* Copyright `IMDaDaGo` Author(https://houseme.github.io/imdadago/). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* You can obtain one at https://github.com/houseme/imdada-go.
* You can obtain one at https://github.com/houseme/imdadago.
*/

// Package domain is the domain of ImDaDa.
Expand Down
4 changes: 2 additions & 2 deletions domain/orders.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright `IMDaDa-Go` Author(https://houseme.github.io/imdada-go/). All Rights Reserved.
* Copyright `IMDaDaGo` Author(https://houseme.github.io/imdadago/). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* You can obtain one at https://github.com/houseme/imdada-go.
* You can obtain one at https://github.com/houseme/imdadago.
*/

// Package domain is the domain of ImDaDa.
Expand Down
4 changes: 2 additions & 2 deletions domain/recharge.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright `IMDaDa-Go` Author(https://houseme.github.io/imdada-go/). All Rights Reserved.
* Copyright `IMDaDaGo` Author(https://houseme.github.io/imdadago/). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* You can obtain one at https://github.com/houseme/imdada-go.
* You can obtain one at https://github.com/houseme/imdadago.
*/

// Package domain is the domain of ImDaDa.
Expand Down
5 changes: 2 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/houseme/imdada-go
module github.com/houseme/imdadago

go 1.19

Expand All @@ -11,7 +11,7 @@ require (
)

require (
github.com/BurntSushi/toml v1.2.1 // indirect
github.com/BurntSushi/toml v1.3.2 // indirect
github.com/andeya/ameda v1.5.3 // indirect
github.com/andeya/goutil v1.0.1 // indirect
github.com/bytedance/go-tagexpr/v2 v2.9.8 // indirect
Expand All @@ -22,7 +22,6 @@ require (
github.com/golang/protobuf v1.5.3 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/nyaruka/phonenumbers v1.1.7 // indirect
github.com/tidwall/gjson v1.14.4 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
Expand Down
Loading