-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from Vacxe/commit-changes
Add edit id for commands
- Loading branch information
Showing
44 changed files
with
248 additions
and
154 deletions.
There are no files selected for viewing
147 changes: 93 additions & 54 deletions
147
src/main/kotlin/com/github/vacxe/googleplaycli/Commands.kt
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 8 additions & 8 deletions
16
src/main/kotlin/com/github/vacxe/googleplaycli/actions/Details.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,40 @@ | ||
package com.github.vacxe.googleplaycli.actions | ||
|
||
import com.github.vacxe.googleplaycli.actions.model.DefaultModel | ||
import com.github.vacxe.googleplaycli.actions.model.DetailsPatchModel | ||
import com.github.vacxe.googleplaycli.actions.model.DetailsUpdateModel | ||
import com.github.vacxe.googleplaycli.actions.model.EditModel | ||
import com.google.api.services.androidpublisher.AndroidPublisher | ||
import com.google.api.services.androidpublisher.model.AppDetails | ||
|
||
interface Details : BaseAction { | ||
fun detailsGet(model: DefaultModel): AppDetails { | ||
fun detailsGet(model: EditModel): AppDetails { | ||
val edits: AndroidPublisher.Edits = androidPublisher.edits() | ||
val insert = edits.insert(model.packageName, null).execute() | ||
return edits.details().get(model.packageName, insert.id).execute() | ||
val editId = model.editId ?: edits.insert(model.packageName, null).execute().id | ||
return edits.details().get(model.packageName, editId).execute() | ||
} | ||
|
||
fun detailsPatch(model: DetailsPatchModel): AppDetails { | ||
val edits: AndroidPublisher.Edits = androidPublisher.edits() | ||
val insert = edits.insert(model.packageName, null).execute() | ||
val editId = model.editId ?: edits.insert(model.packageName, null).execute().id | ||
val appDetails = AppDetails().apply { | ||
model.contactEmail?.let { contactEmail = it } | ||
model.contactPhone?.let { contactPhone = it } | ||
model.contactWebsite?.let { contactWebsite = it } | ||
model.defaultLanguage?.let { defaultLanguage = it } | ||
} | ||
return edits.details().patch(model.packageName, insert.id, appDetails).execute() | ||
return edits.details().patch(model.packageName, editId, appDetails).execute() | ||
} | ||
|
||
fun detailsUpdate(model: DetailsUpdateModel): AppDetails { | ||
val edits: AndroidPublisher.Edits = androidPublisher.edits() | ||
val insert = edits.insert(model.packageName, null).execute() | ||
val editId = model.editId ?: edits.insert(model.packageName, null).execute().id | ||
val appDetails = AppDetails().apply { | ||
model.contactEmail?.let { contactEmail = it } | ||
model.contactPhone?.let { contactPhone = it } | ||
model.contactWebsite?.let { contactWebsite = it } | ||
model.defaultLanguage?.let { defaultLanguage = it } | ||
} | ||
return edits.details().update(model.packageName, insert.id, appDetails).execute() | ||
return edits.details().update(model.packageName, editId, appDetails).execute() | ||
} | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
src/main/kotlin/com/github/vacxe/googleplaycli/actions/Edit.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.github.vacxe.googleplaycli.actions | ||
|
||
import com.github.vacxe.googleplaycli.actions.model.DefaultModel | ||
import com.github.vacxe.googleplaycli.actions.model.EditModel | ||
import com.google.api.services.androidpublisher.AndroidPublisher | ||
import com.google.api.services.androidpublisher.model.AppEdit | ||
|
||
interface Edit: BaseAction { | ||
fun editCreate(model: DefaultModel): String { | ||
val edits: AndroidPublisher.Edits = androidPublisher.edits() | ||
val insert = edits.insert(model.packageName, null).execute() | ||
return insert.id | ||
} | ||
|
||
fun editCommit(model: EditModel): AppEdit { | ||
val edits: AndroidPublisher.Edits = androidPublisher.edits() | ||
return edits.commit(model.packageName, model.editId).execute() | ||
} | ||
|
||
fun editValidate(model: EditModel): AppEdit { | ||
val edits: AndroidPublisher.Edits = androidPublisher.edits() | ||
return edits.validate(model.packageName, model.editId).execute() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 1 addition & 6 deletions
7
src/main/kotlin/com/github/vacxe/googleplaycli/actions/Inappproducts.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.